You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First thanks for implementing this. Manually cancelling builds is quite a hassle.
I am about to add this to our workflows but if I understand this currently it would apply to any build including trunk and tags which is not what we want. We want to have builds for all of those commits. So basically we just want it for pull_request. Since there's no if it seems that requires some meddling.
Since it should only apply to pull_request we need to use ${{ github.head_ref }}. So just using group: ${{ github.head_ref }} should be fine - assuming an empty group is allowed and treated as no group at all thus it is ignored (that needs clarification - see below).
But it also needs to be limited by workflow so it needs to be group: ${{ github.workflow }}-${{ github.head_ref }}. But that would lead to a partial string which would match quite broadly in case we are not in a pull_request. So I would require some logic which only produces a string from the expression if it is a pull_request and only produces the string with the pattern above (still assuming an empty group would not cause any cancellations).
I have also seen implementations which added ${{ github.repository }} to the group. That might be for clarification or because these are shared in different repos. Or can this spill into other repo/forks and affect those if the group matches across those?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First thanks for implementing this. Manually cancelling builds is quite a hassle.
I am about to add this to our workflows but if I understand this currently it would apply to any build including trunk and tags which is not what we want. We want to have builds for all of those commits. So basically we just want it for
pull_request
. Since there's noif
it seems that requires some meddling.Since it should only apply to
pull_request
we need to use${{ github.head_ref }}
. So just usinggroup: ${{ github.head_ref }}
should be fine - assuming an empty group is allowed and treated as no group at all thus it is ignored (that needs clarification - see below).But it also needs to be limited by workflow so it needs to be
group: ${{ github.workflow }}-${{ github.head_ref }}
. But that would lead to a partial string which would match quite broadly in case we are not in apull_request
. So I would require some logic which only produces a string from the expression if it is apull_request
and only produces the string with the pattern above (still assuming an emptygroup
would not cause any cancellations).I have also seen implementations which added
${{ github.repository }}
to thegroup
. That might be for clarification or because these are shared in different repos. Or can this spill into other repo/forks and affect those if thegroup
matches across those?Also regarding the documentation at https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency:
group
is empty?Beta Was this translation helpful? Give feedback.
All reactions