eBPF-based security platform
ci: stop a merge to main from cancelling the run of the one before
Tobias Klauser779bb01b9f5a
diff --git a/.github/scripts/is-main-head.sh b/.github/scripts/is-main-head.shnew file mode 100755index 00000000..68304669--- /dev/null+++ b/.github/scripts/is-main-head.sh@@ -0,0 +1,22 @@+#!/bin/sh+# SPDX-License-Identifier: BSD-2-Clause+# Copyright (c) 2026 Authors of shirudo+#+# .github/scripts/is-main-head.sh -- tell whether the commit a run was+# started for is still the head of main: writes current=true or+# current=false to $GITHUB_OUTPUT.+#+# .github/scripts/is-main-head.sh+#+# The commit is SHA, the repository GITHUB_REPOSITORY, and gh reads the+# token from GH_TOKEN.++set -eu++head=$(gh api "repos/$GITHUB_REPOSITORY/git/ref/heads/main" --jq .object.sha)+if [ "$head" = "$SHA" ]; then+ echo "current=true" >>"$GITHUB_OUTPUT"+else+ echo "::notice::main moved on from $SHA to $head, whose run takes over"+ echo "current=false" >>"$GITHUB_OUTPUT"+fidiff --git a/.github/workflows/build-commits.yml b/.github/workflows/build-commits.ymlindex 4ba051f4..6a386049 100644--- a/.github/workflows/build-commits.yml+++ b/.github/workflows/build-commits.yml@@ -9,9 +9,13 @@ on:permissions:contents: read-# A new push to the pull request supersedes the run in progress.+# A newer push to a pull request supersedes its run. Any other run is+# keyed on its ref and commit, so a merge never cancels another's run.concurrency:- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}+ group: |+ ${{ github.workflow }}+ ${{ github.event_name }}+ ${{ github.event.pull_request.number || format('{0}@{1}', github.ref, github.sha) }}cancel-in-progress: truejobs:diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex 072362a2..2feec04e 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -9,9 +9,13 @@ on:permissions:contents: read-# A newer run for the same branch or pull request supersedes this one.+# A newer push to a pull request supersedes its run. Any other run is+# keyed on its ref and commit, so a merge never cancels another's run.concurrency:- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}+ group: |+ ${{ github.workflow }}+ ${{ github.event_name }}+ ${{ github.event.pull_request.number || format('{0}@{1}', github.ref, github.sha) }}cancel-in-progress: truejobs:diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.ymlindex c361db84..54c84230 100644--- a/.github/workflows/codeql.yml+++ b/.github/workflows/codeql.yml@@ -9,9 +9,13 @@ on:permissions:contents: read-# A newer run for the same branch or pull request supersedes this one.+# A newer push to a pull request supersedes its run. Any other run is+# keyed on its ref and commit, so a merge never cancels another's run.concurrency:- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}+ group: |+ ${{ github.workflow }}+ ${{ github.event_name }}+ ${{ github.event.pull_request.number || format('{0}@{1}', github.ref, github.sha) }}cancel-in-progress: truejobs:diff --git a/.github/workflows/dco.yml b/.github/workflows/dco.ymlindex 3ef05de2..65ae3f12 100644--- a/.github/workflows/dco.yml+++ b/.github/workflows/dco.yml@@ -9,9 +9,13 @@ on:permissions:contents: read-# A newer run for the same branch or pull request supersedes this one.+# A newer push to a pull request supersedes its run. Any other run is+# keyed on its ref and commit, so a merge never cancels another's run.concurrency:- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}+ group: |+ ${{ github.workflow }}+ ${{ github.event_name }}+ ${{ github.event.pull_request.number || format('{0}@{1}', github.ref, github.sha) }}cancel-in-progress: truejobs:diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.ymlindex a005973d..7ba8a123 100644--- a/.github/workflows/docs.yml+++ b/.github/workflows/docs.yml@@ -15,11 +15,14 @@ permissions:jobs:docs:runs-on: ubuntu-latest- # A newer run for the same pull request supersedes this one. On main a- # render in flight finishes, so a busy main still deploys.+ # A newer push to a pull request supersedes its run. Any other run is+ # keyed on its ref and commit, so a merge never cancels another's run.concurrency:- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}- cancel-in-progress: ${{ github.event_name == 'pull_request' }}+ group: |+ ${{ github.workflow }}+ ${{ github.event_name }}+ ${{ github.event.pull_request.number || format('{0}@{1}', github.ref, github.sha) }}+ cancel-in-progress: truesteps:- name: Check out repository@@ -66,6 +69,21 @@ jobs:cancel-in-progress: falsesteps:+ - name: Check out the CI scripts+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1+ with:+ persist-credentials: false+ sparse-checkout: .github/scripts++ # Renders on main can finish out of order: only main's head deploys.+ - name: Check that main has not moved on+ id: head+ env:+ GH_TOKEN: ${{ github.token }}+ SHA: ${{ github.sha }}+ run: .github/scripts/is-main-head.sh+- name: Deploy to GitHub Pages+ if: steps.head.outputs.current == 'true'id: deploymentuses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.ymlindex 834c5cb7..a211fb60 100644--- a/.github/workflows/lint.yml+++ b/.github/workflows/lint.yml@@ -9,9 +9,13 @@ on:permissions:contents: read-# A newer run for the same branch or pull request supersedes this one.+# A newer push to a pull request supersedes its run. Any other run is+# keyed on its ref and commit, so a merge never cancels another's run.concurrency:- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}+ group: |+ ${{ github.workflow }}+ ${{ github.event_name }}+ ${{ github.event.pull_request.number || format('{0}@{1}', github.ref, github.sha) }}cancel-in-progress: truejobs:diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.ymlindex 73d29658..0e4c83d1 100644--- a/.github/workflows/packages.yml+++ b/.github/workflows/packages.yml@@ -18,9 +18,13 @@ on:permissions:contents: read-# A newer run for the same branch or pull request supersedes this one.+# A newer push to a pull request supersedes its run. Any other run is+# keyed on its ref and commit, so a merge never cancels another's run.concurrency:- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}+ group: |+ ${{ github.workflow }}+ ${{ github.event_name }}+ ${{ github.event.pull_request.number || format('{0}@{1}', github.ref, github.sha) }}cancel-in-progress: truejobs:@@ -343,6 +347,11 @@ jobs:needs: [deb, rpm-target]runs-on: ubuntu-latesttimeout-minutes: 30+ # bpm push rewrites the signed index, so publishes run one at a time.+ # GitHub drops all but the newest waiting one, the greatest version.+ concurrency:+ group: ${{ github.workflow }}-kernel-obs-publish+ cancel-in-progress: falseenvironment:name: kernel-obspermissions:diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.ymlindex 62f9dade..f4aadead 100644--- a/.github/workflows/sanitizers.yml+++ b/.github/workflows/sanitizers.yml@@ -12,9 +12,13 @@ on:permissions:contents: read-# A newer run for the same branch or pull request supersedes this one.+# A newer push to a pull request supersedes its run. Any other run is+# keyed on its ref and commit, so a merge never cancels another's run.concurrency:- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}+ group: |+ ${{ github.workflow }}+ ${{ github.event_name }}+ ${{ github.event.pull_request.number || format('{0}@{1}', github.ref, github.sha) }}cancel-in-progress: truejobs:diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex c0e40a54..5e383ec3 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -16,9 +16,13 @@ permissions:contents: readactions: read-# A newer run for the same branch or pull request supersedes this one.+# A newer push to a pull request supersedes its run. Any other run is+# keyed on its ref and commit, so a merge never cancels another's run.concurrency:- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}+ group: |+ ${{ github.workflow }}+ ${{ github.event_name }}+ ${{ github.event.pull_request.number || format('{0}@{1}', github.ref, github.sha) }}cancel-in-progress: truejobs: