cancel-workflow-action icon indicating copy to clipboard operation
cancel-workflow-action copied to clipboard

Cancel previous runs of same workflow id on all branches

Open vvasuki opened this issue 3 years ago • 4 comments

Scenario: I have a content branch and a master branch. An identical workflow runs in case of push to either branches, resulting in race condition.

Expection: I would like to be able to cancel prior workflow runs irrespective of the branch. README file makes me think that this is currently not supported -

this GitHub Action will capture the current Branch and SHA. It will query GitHub's API to find previous workflow runs that match the Branch but do not match the SHA.

Example of the race conditions I want to avoid with this feature (from here):

image

vvasuki avatar May 11 '21 16:05 vvasuki

Indeed, the branch is necessary https://github.com/styfle/cancel-workflow-action/blob/ad6cb1b847ffb509a69b745b6ee2f1d14dfe14b8/src/index.ts#L22-L30

We might be able to add an option for ignore_branch: true to only use the SHA 🤔

styfle avatar May 14 '21 01:05 styfle

We might be able to add an option for ignore_branch: true to only use the SHA

That's indeed what I seek!

vvasuki avatar May 14 '21 08:05 vvasuki

Great! Do you want to submit a PR?

styfle avatar May 16 '21 15:05 styfle

Great! Do you want to submit a PR?

Much as I'd like to contribute, I don't have the bandwidth to learn this system and make the fix myself :-(

vvasuki avatar May 17 '21 11:05 vvasuki