From f23afb5adb438ba5d86c267c8a6a178e6f5fe2b9 Mon Sep 17 00:00:00 2001 From: sudo-py-dev Date: Wed, 2 Dec 2026 18:40:07 +0200 Subject: [PATCH] ci: add a ci-ok gate job for branch protection Adds a final `ci-ok` job that needs `build-and-test`; cancel outdated PR runs (`concurrency`). The main protection ruleset will require the ci-ok check once this is merged. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b7aaa8..146fff5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,11 @@ on: pull_request: branches: [ main ] +# A new push to a PR cancels that PR's older runs; runs on main are never cancelled. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + permissions: contents: read @@ -29,3 +34,18 @@ jobs: - name: Run Unit Tests run: ./gradlew test + + # Single check for branch protection: passes only when every job above passed + # (or was skipped on purpose). The "main protection" ruleset requires it. + ci-ok: + name: ci-ok + if: always() + needs: [build-and-test] + runs-on: ubuntu-latest + steps: + - name: Check results + env: + RESULTS: ${{ join(needs.*.result, ' ') }} + run: | + echo "job results: $RESULTS" + case " $RESULTS " in *" failure "*|*" cancelled "*) exit 1 ;; esac