Conversation
Take 2, using GitHub's native functionality. Basically reverts apache#3004. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
|
/cc @kbendick |
There was a problem hiding this comment.
Thanks for tagging me @snazy. I looked into this when I made the original cancel duplicate workloads file, but it was pretty beta at the time and I couldn't get the group such that it would cancel the same PR (I didn't try that hard as it was pretty new functionality and the apache/spark repo uses the other project).
Have you tested this configuration in your own repo, or in any other repo? Does it work the same?
|
Ahhh I see the docs have been updated and this concurrency group is explicitly called out: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow My (very limited) experience was that it would cancel any workflow (outside of the current PR or not), but I guess if you have This looks to cover all of the workflows that were part of the old cancel-duplicates. |
kbendick
left a comment
There was a problem hiding this comment.
Gonna give this a cautious +1 for the reasons mentioned.
If you've used this concurrency group and it worked as expected (cancels duplicates from the same branch), then I'm good with it. Like I said, when I tried it before it was very beta but it would be nice to use the native functionality.
If you don't have experience with it, we should maybe test it quickly in a fork or something (or have a committer on hand to revert).
|
Looking at this Stack Overflow post, I'm much more confident in this now: https://stackoverflow.com/questions/58033366/how-to-get-the-current-branch-within-github-actions |
|
We've merged the same change into Nessie today and I realized that Quarkus is also using this technique now - they have more complex conditions though: https://github.com/quarkusio/quarkus/blob/main/.github/workflows/ci-actions-incremental.yml#L36-L38 |
|
Realized that the proposed change would cancel previous CI runs on the master branch as well, which is rather not so good. So I've pushed another commit. |
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
There was a problem hiding this comment.
Good call 👍 .
Maybe I would add a default value of ${{ github.event_name == 'pull_request' || false }}. But I don't think that's needed because event_name should be defined for all.
There was a problem hiding this comment.
Yea, no event without a name (I hope so ;) )
|
Thanks for fixing this, @snazy! |
Take 2, using GitHub's native functionality.
Basically reverts #3004.
See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency