From 45ceedc25033ae429fd2834d3aa44ec3a06368ae Mon Sep 17 00:00:00 2001 From: Tanya Date: Thu, 8 Jan 2026 13:21:49 -0500 Subject: [PATCH] chore: Enhance CI workflow concurrency management for push and PR events This commit updates the CI workflow to improve concurrency management by grouping runs based on branch name and commit SHA. It ensures that push and PR events for the same branch and commit are handled together, preventing duplicate executions. Additionally, it clarifies comments regarding the handling of events, enhancing the overall clarity and efficiency of the CI process. --- .gitea/workflows/ci.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 0a1f802..6e240cd 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -15,13 +15,13 @@ on: # Prevent duplicate runs when pushing to a branch with an open PR # This ensures only one workflow runs at a time for the same commit concurrency: - # Use commit SHA to unify push and PR events for the same commit + # Use commit SHA and branch to unify push and PR events for the same commit # This prevents duplicate runs when both push and PR events fire for the same commit - # For PRs: uses head SHA (the commit being tested) - # For pushes: uses the commit SHA from the push event (github.event.after or github.sha) - # The group name combines workflow name with commit SHA to ensure uniqueness - # If both push and PR events fire for the same commit, only one will run - group: ${{ github.workflow }}-${{ github.event.pull_request.head.sha || github.event.after || github.sha }} + # For PRs: uses base branch (target) and head SHA (the commit being tested) + # For pushes: uses branch name and commit SHA from the push event + # The group ensures push and PR events for the same branch+commit are grouped together + # If both push and PR events fire for the same commit on the same branch, only one will run + group: ${{ github.workflow }}-${{ github.event.pull_request.base.ref || github.ref_name }}-${{ github.event.pull_request.head.sha || github.event.after || github.sha }} cancel-in-progress: true jobs: @@ -65,6 +65,8 @@ jobs: echo "Skipping CI: Push event on feature branch '$BRANCH_NAME' (use PR events instead)" SKIP=1 fi + # Note: For dev/master, we rely on concurrency group to prevent duplicates + # If both push and PR events fire, concurrency will cancel one fi # Check branch name (case-insensitive)