From 621416a2408952eec8007e06e81f4dc21baa8ab0 Mon Sep 17 00:00:00 2001 From: cpovirk Date: Mon, 3 Aug 2026 13:07:07 -0700 Subject: [PATCH] Modernize cancellation configuration. https://github.com/google/guice/commit/35173790910fd604e01c763df2ce9c4ae33e5198 probably used the best tools available in 2022. But this PR's approach, which we've been using with success [in Guava](https://github.com/google/guava/blob/0adf237b742d899d00239dfeefdd42807ff46a83/.github/workflows/ci.yml#L14-L17) and in other projects, looks to be [the recommended approach](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#example-using-a-fallback-value) nowadays. In particular, I wonder if the current setup is over-canceling: Currently, I see reports like ["Canceling since a higher priority waiting request for ci-main-b7c7483a46afadd43a2f04935aaee5ff0cd09145 exists"](https://github.com/google/guice/actions/runs/30832661591/job/91750157428) on a large number of jobs, causing GitHub to report the overall CI status as "failure." RELNOTES=n/a PiperOrigin-RevId: 958535716 --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4605d07bb3..f8eb589849 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,10 +18,10 @@ on: - master concurrency: - # On main branch, we don't want any jobs cancelled so the sha is used to name the group - # On PR branches, we cancel the job if new commits are pushed - # More info: https://stackoverflow.com/a/68422069/253468 - group: ${{ (github.ref == 'refs/heads/master') && format('ci-main-{0}', github.sha) || format('ci-main-{0}', github.ref) }} + # For a PR, cancel a job if a new commit is pushed. + # For other pushes to branches, don't cancel jobs. + # https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#example-using-a-fallback-value + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: