From e24764491a2ce1fd641157575c38e735deb1ae53 Mon Sep 17 00:00:00 2001 From: cpovirk Date: Mon, 6 Jul 2026 13:33:37 -0700 Subject: [PATCH] Use `cancel-in-progress` instead of `styfle/cancel-workflow-action`. Advantages: - We don't need to grant write permissions to a third-party action (or even use it at all). - Not that I have any reason to think it's likely to be a problem, but strange things happen sometimes. - One less action means one less thing for us to merge Dependabot updates for. - The new approach can easily allow CI for merged trunk commits to continue even after other trunk commits are merged, while still stopping PR CI when new changes are pushed. - This is especially nice because cancellations (at least those from `styfle/cancel-workflow-action`, maybe in general) show up as _failures_. It's nice to be able to pick out _real_ failures (e.g., those fixed by cl/925609698 and cl/943404496) without sorting through cancellations. - All else being equal, it's nice to have smaller, simpler configuration. Assuming that this approach holds up, I'll replicate it to our other projects. RELNOTES=n/a PiperOrigin-RevId: 943469061 --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f5026c0b0..b7492289b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,11 @@ on: branches: - main +# Cancel in-progress runs for pull requests, but not for master branch pushes +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: test: name: "JDK ${{ matrix.java }}" @@ -16,11 +21,6 @@ jobs: java: [ 8, 11, 17 ] runs-on: ubuntu-latest steps: - # Cancel any previous runs for the same branch that are still running. - - name: 'Cancel previous runs' - uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 - with: - access_token: ${{ github.token }} - name: 'Check out repository' uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 - name: 'Cache local Maven repository'