-
Notifications
You must be signed in to change notification settings - Fork 247
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
Replace styfle/cancel-workflow-action with new GitHub concurrency:
standard
#2316
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e639148
Replace styfle/cancel-workflow-action with new GitHub concurrency: st…
vorburger 4e88ebd
Merge branch 'master' into actions-clean-up3
vorburger e8f8273
Update build.yml
vorburger 4618f0d
Merge branch 'master' into actions-clean-up3
vorburger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the run_id is included here in the group id, does this not mean that each run will have a separate group id? and does that mean previous runs will not be cancelled?
actually, if the head_ref is part of this, how would cancellation even help anything? shouldn't we cancel jobs that are in the same branch? i.e. if you push a new commit we should cancel the previous job?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now had a closer look at related docs about this (e.g. https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts#github-context) and, as far as I understand it, believe this to be correct as-is, because:
||
are fallback values (not "concatenations") so my understanding is that e.g. therun_id
would not be included as long as ahead_ref
or elseref
was non-NILhead_ref
is (quote) "the source branch of the pull request in a workflow run" - which will (should, based on doc) cancel jobs that are in the same branch - I think? But note that, quote: "This property is only available when the event that triggers a workflow run is either pull_request or pull_request_target." ...ref
is a fallback to (quote) "(...) For workflows triggered by push, this is the branch or tag ref that was pushed (...) " From the doc it seems like it may actually be sufficient to use only this, but given that http://go/github-actions#cancel-workflows suggests to use the combination, I went with that; I suspect it can't harm to be double extra saferun_id
is a last fallback is something I thought I saw on some example yesterday. I'm not sure if this will be used, but given thatref
docs says that it's "only set if a branch or tag is available for the event type" it seems like a sensible pre-caution as a last resort? I can also remove it, if you think it's confusing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks michael for the explanation.
this is clear to me now.
up to you about the run_id. but either way can we add a single line of comment to explain what's happening here? doesn't have to go to the length of your comment above, but just noting that we're using the branch/pr ref etc so possible to cancel previous runs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
once addressed please feel free to merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
github.run_id
and added inline documentation comments; I will self merge when build is green.