mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-12 02:40:31 +08:00
workflows: cancel running jobs on pull request updates
We can avoid running old jobs to completion, when pushing changes to a
pull request. This is done via concurrency groups. We set them on the
workflow level, with the following keys in the group name:
- `github.workflow` to only cancel / block the same workflow.
- `github.event_name` to avoid blocking between pull_request and
pull_request_target.
- `github.head_ref` which is unique for a PR, but the same when changing
it. This will cause PRs to cancel in progress jobs. Unset on pushes to
master & co.
- `github.run_id` as fallback for push events. In this case, the run_id
is unique for every push, thus *no* cancelling happens on the dev
branches.
(cherry picked from commit 6d4b1f8e30)
This commit is contained in:
committed by
github-actions[bot]
parent
901651f7ab
commit
f8340acd43
4
.github/workflows/check-cherry-picks.yml
vendored
4
.github/workflows/check-cherry-picks.yml
vendored
@@ -10,6 +10,10 @@ on:
|
||||
- 'staging-**'
|
||||
- '!staging-next'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
|
||||
4
.github/workflows/check-format.yml
vendored
4
.github/workflows/check-format.yml
vendored
@@ -6,6 +6,10 @@ on:
|
||||
- .github/workflows/check-format.yml
|
||||
pull_request_target:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
|
||||
4
.github/workflows/check-shell.yml
vendored
4
.github/workflows/check-shell.yml
vendored
@@ -9,6 +9,10 @@ on:
|
||||
- 'shell.nix'
|
||||
- 'ci/**'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
|
||||
4
.github/workflows/codeowners-v2.yml
vendored
4
.github/workflows/codeowners-v2.yml
vendored
@@ -29,6 +29,10 @@ on:
|
||||
pull_request_target:
|
||||
types: [opened, ready_for_review, synchronize, reopened]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
env:
|
||||
|
||||
4
.github/workflows/edited.yml
vendored
4
.github/workflows/edited.yml
vendored
@@ -16,6 +16,10 @@ on:
|
||||
pull_request_target:
|
||||
types: [edited]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
|
||||
4
.github/workflows/eval-aliases.yml
vendored
4
.github/workflows/eval-aliases.yml
vendored
@@ -6,6 +6,10 @@ on:
|
||||
- .github/workflows/eval-aliases.yml
|
||||
pull_request_target:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
|
||||
6
.github/workflows/eval.yml
vendored
6
.github/workflows/eval.yml
vendored
@@ -16,6 +16,10 @@ on:
|
||||
- haskell-updates
|
||||
- python-updates
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
@@ -290,3 +294,5 @@ jobs:
|
||||
if: needs.prepare.outputs.targetSha
|
||||
uses: ./.github/workflows/reviewers.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
caller: ${{ github.workflow }}
|
||||
|
||||
4
.github/workflows/labels.yml
vendored
4
.github/workflows/labels.yml
vendored
@@ -8,6 +8,10 @@ name: "Label PR"
|
||||
on:
|
||||
pull_request_target:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write # needed to create *new* labels
|
||||
|
||||
4
.github/workflows/lib-tests.yml
vendored
4
.github/workflows/lib-tests.yml
vendored
@@ -9,6 +9,10 @@ on:
|
||||
- 'lib/**'
|
||||
- 'maintainers/**'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
|
||||
4
.github/workflows/manual-nixos-v2.yml
vendored
4
.github/workflows/manual-nixos-v2.yml
vendored
@@ -18,6 +18,10 @@ on:
|
||||
# Since the lib functions are used to 'massage' the options before producing the manual
|
||||
- "lib/**"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
|
||||
4
.github/workflows/manual-nixpkgs-v2.yml
vendored
4
.github/workflows/manual-nixpkgs-v2.yml
vendored
@@ -10,6 +10,10 @@ on:
|
||||
- 'lib/**'
|
||||
- 'pkgs/by-name/ni/nixdoc/**'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
|
||||
4
.github/workflows/nix-parse-v2.yml
vendored
4
.github/workflows/nix-parse-v2.yml
vendored
@@ -6,6 +6,10 @@ on:
|
||||
- .github/workflows/nix-parse-v2.yml
|
||||
pull_request_target:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
|
||||
4
.github/workflows/nixpkgs-vet.yml
vendored
4
.github/workflows/nixpkgs-vet.yml
vendored
@@ -11,6 +11,10 @@ on:
|
||||
- .github/workflows/nixpkgs-vet.yml
|
||||
pull_request_target:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
# We don't use a concurrency group here, because the action is triggered quite often (due to the PR edit trigger), and contributors would get notified on any canceled run.
|
||||
|
||||
9
.github/workflows/reviewers.yml
vendored
9
.github/workflows/reviewers.yml
vendored
@@ -10,6 +10,15 @@ on:
|
||||
pull_request_target:
|
||||
types: [ready_for_review]
|
||||
workflow_call:
|
||||
inputs:
|
||||
caller:
|
||||
description: Name of the calling workflow.
|
||||
required: true
|
||||
type: string
|
||||
|
||||
concurrency:
|
||||
group: ${{ inputs.caller }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user