Skip to content

Commit

Permalink
[CI] Only run one post commit job on a push to a pull request in sycl…
Browse files Browse the repository at this point in the history
…-devops-pr (#16079)

Kind of a really specific case, but if someone pushes to
`sycl-devops-pr` to run postcommit and then makes a PR from the same
branch, both the initial pull request event and every subsequent push to
the branch will cause two postcommits to run, one from the push to the
branch and one from the PR.

Use a unique key that will be the same in both cases so only one is run
and the other is cancelled.

Nobody really uses this branch besides CI devs so we don't need to
overengineer it so it never runs two in the first place IMO.

---------

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
  • Loading branch information
sarnex authored Nov 13, 2024
1 parent 0a3a324 commit 80b63a2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/sycl-post-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ on:
- ./devops/actions/cached_checkout

concurrency:
# Cancel a currently running workflow from the same PR or commit hash.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
# Cancel a currently running workflow from the same PR or commit hash.
# We need to use the user's branch name (which is in different variables
# for pull request events and push events) so that making a PR from a
# sycl-devops-pr branch doesn't cause two postcommit runs.
group: "${{ github.actor }}-${{ github.head_ref || github.ref_name }}"
cancel-in-progress: true

permissions: read-all
Expand Down

0 comments on commit 80b63a2

Please sign in to comment.