From 0af192bdf0538dd17ee3cc13636b05588cf9c719 Mon Sep 17 00:00:00 2001 From: Feng Ruohang Date: Sun, 30 Aug 2026 23:12:08 +0800 Subject: [PATCH] ci: key the concurrency group on the pull request or branch github.head_ref is only set on pull_request events. On push and workflow_dispatch it is empty, so every such run shared one group per workflow and cancel-in-progress made each cancel the last -- two pushes to main in quick succession, or a manual run alongside a push, could leave main with no completed CI. Key on the pull request number with a branch fallback, matching silo-console. Signed-off-by: Feng Ruohang --- .github/workflows/go.yml | 7 ++++--- .github/workflows/ldap.yaml | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 55d1314..a120f7a 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -7,10 +7,11 @@ on: branches: [main] workflow_dispatch: -# This ensures that previous jobs for the PR are canceled when the PR is -# updated. +# Cancel a superseded run for the same pull request or branch. github.head_ref +# is only set on pull_request events, so keying on it alone put every push and +# manual run in one group, where they cancelled each other. concurrency: - group: ${{ github.workflow }}-${{ github.head_ref }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true permissions: diff --git a/.github/workflows/ldap.yaml b/.github/workflows/ldap.yaml index 1bac577..c616010 100644 --- a/.github/workflows/ldap.yaml +++ b/.github/workflows/ldap.yaml @@ -7,10 +7,11 @@ on: branches: [main] workflow_dispatch: -# This ensures that previous jobs for the PR are canceled when the PR is -# updated. +# Cancel a superseded run for the same pull request or branch. github.head_ref +# is only set on pull_request events, so keying on it alone put every push and +# manual run in one group, where they cancelled each other. concurrency: - group: ${{ github.workflow }}-${{ github.head_ref }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true permissions: