Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancel previous runs of same workflow id on all branches #86

Open
vvasuki opened this issue May 11, 2021 · 4 comments · May be fixed by #207
Open

Cancel previous runs of same workflow id on all branches #86

vvasuki opened this issue May 11, 2021 · 4 comments · May be fixed by #207
Labels
enhancement New feature or request

Comments

@vvasuki
Copy link

vvasuki commented May 11, 2021

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

@styfle
Copy link
Owner

styfle commented May 14, 2021

Indeed, the branch is necessary

let branch = ref.slice(11);
let headSha = sha;
if (payload.pull_request) {
branch = payload.pull_request.head.ref;
headSha = payload.pull_request.head.sha;
} else if (payload.workflow_run) {
branch = payload.workflow_run.head_branch;
headSha = payload.workflow_run.head_sha;
}

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

@vvasuki
Copy link
Author

vvasuki commented May 14, 2021

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

That's indeed what I seek!

@styfle
Copy link
Owner

styfle commented May 16, 2021

Great! Do you want to submit a PR?

@vvasuki
Copy link
Author

vvasuki commented May 17, 2021

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 :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants