-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
Workflow filter incorrectly includes/cancels runs from other branches #82
Comments
That's really odd. They allow it in the octokit sdk so I wonder if it was recently removed from the API? |
The old API docs mention |
At the very least, it sounds like a bug in @actions/github since it accepts the
|
definitely agree - it hasn't risen above "notable, and a nuisance" for me yet so I haven't taken the time to run it down over on that side but I do think it's an issue with this action as collateral damage |
looks like I'm hitting this too. Just tried the action out for the first time yesterday |
Unfortunately I definitely won't have time to track it down, but my clearest recollection of it based on close examination of output was exactly as above, filter by branch just wasn't working, and it could be worked around here or fixed upstream in the github workflow run query (if that's open?) |
I've hit this myself as well... The bad news is that this issue was a deal-breaker for us; Basically, as most of you probably figured out, this action assumes that if two branches have the same name, while this is not necessarily true (for example, the This behavior can be seen in this PR, for example, which caused this Extended description of the bug in our case (using the PR workaround):
|
I'm looking at the PR in question but I don't see any workflow run with "cancel". So perhaps the bug is only present when using events other than "push"? |
@styfle that's a github thing - if a workflow is triggered from a PR, that workflow will not appear in the workflow list for that PR. If you think about it, it makes sense, since github treats that workflow as belonging to the parent repo, not the pr, thus causing this bug. |
The fix in 8cbb31 looks good. I think you can use |
Oh, thanks for the tip. Would you be willing to accept a PR with that patch? |
Yes, that would be great, thanks! |
I can't adequately explain it, but currently the only explanation I have for the behavior I just saw is that this line is not filtering runs from other branches:
cancel-workflow-action/src/index.ts
Line 69 in ad6cb1b
Specifically this happened in an "all_but_latest" self-cancelling config:
1- workflow run on a PR from a branch starts
2- I merge to master branch (triggers another run)
3- I merge again to master branch (triggers another run)
Run 3 cancelled 1 and 2 even though 1 was on another branch
It looks like the workflow_id is not a parameter that the octokit API call accepts, but branch definitely is
https://docs.github.com/en/enterprise-server@2.22/rest/reference/actions#list-workflow-runs-for-a-repository--parameters
The current run ids would not match, the head_shas did not match, nothing matched so they didn't get filtered - thus my only guess is that the repo workflow list call was expected to filter on branch but clearly did not, which is unexpected.
🤔
The text was updated successfully, but these errors were encountered: