From b51b72b39cf0d93f260699251365369f7e9c3abd Mon Sep 17 00:00:00 2001 From: willson556 Date: Fri, 16 Oct 2026 17:31:25 +0000 Subject: [PATCH] Add a CI Status check that runs on every PR (#52) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This repo has three test workflows, each filtered to its own paths, and each reports a check named `test`. A PR that touches none of those paths gets no test check at all, so `test` can't be a required check. **Change:** one `CI` workflow replaces `review-tests.yml`, `ci-metrics-tests.yml` and `plan-ci-tier-tests.yml`. - A `changes` job uses `dorny/paths-filter` with the same paths as before to decide which suites to run. A change to `ci.yml` runs all three. - The suites now have distinct check names: Review action tests, CIMetrics tests, PlanCITier tests. - `CI Status` runs on every PR and push to main. It passes only when each suite that should run passed and the rest were skipped. It works the same way as the `CI Status` job in StaflLib's `dispatch.yml`. Once this merges, the repo goes into the `BMS2000 main` org ruleset, which requires `CI Status`. **Testing:** `actionlint` passes. This PR changes `ci.yml`, so all three suites run on it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- .github/workflows/ci-metrics-tests.yml | 19 ---- .github/workflows/ci.yml | 105 +++++++++++++++++++++++ .github/workflows/plan-ci-tier-tests.yml | 21 ----- .github/workflows/review-tests.yml | 21 ----- 4 files changed, 105 insertions(+), 61 deletions(-) delete mode 100644 .github/workflows/ci-metrics-tests.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/plan-ci-tier-tests.yml delete mode 100644 .github/workflows/review-tests.yml diff --git a/.github/workflows/ci-metrics-tests.yml b/.github/workflows/ci-metrics-tests.yml deleted file mode 100644 index 4ab7990..0000000 --- a/.github/workflows/ci-metrics-tests.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: CIMetrics tests - -on: - pull_request: - paths: [CIMetrics/**] - push: - branches: [main] - paths: [CIMetrics/**] - -permissions: - contents: read - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.2 - - uses: astral-sh/setup-uv@v6 - - run: uv run --no-project --with pytest pytest CIMetrics diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1d16c99 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,105 @@ +name: CI + +on: + pull_request: + push: + branches: [main] + +permissions: + contents: read + +jobs: + # Each test suite runs only when its action changed, or when this workflow did. + changes: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + outputs: + review: ${{ steps.filter.outputs.review }} + ci_metrics: ${{ steps.filter.outputs.ci_metrics }} + plan_ci_tier: ${{ steps.filter.outputs.plan_ci_tier }} + steps: + - uses: actions/checkout@v4.1.2 + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + review: + - .github/workflows/ci.yml + - AssignReviewers/** + - ReviewConfig/** + - ReviewSLA/** + ci_metrics: + - .github/workflows/ci.yml + - CIMetrics/** + plan_ci_tier: + - .github/workflows/ci.yml + - PlanCITier/** + + review-tests: + name: Review action tests + needs: changes + if: needs.changes.outputs.review == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.2 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: node --test AssignReviewers/ ReviewConfig/ ReviewSLA/ + + ci-metrics-tests: + name: CIMetrics tests + needs: changes + if: needs.changes.outputs.ci_metrics == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.2 + - uses: astral-sh/setup-uv@v6 + - run: uv run --no-project --with pytest pytest CIMetrics + + plan-ci-tier-tests: + name: PlanCITier tests + needs: changes + if: needs.changes.outputs.plan_ci_tier == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.2 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: node --test PlanCITier/ + + # The required check. It runs on every PR and passes only if each suite that should run passed + # and the rest were skipped. + ci-status: + name: CI Status + needs: [changes, review-tests, ci-metrics-tests, plan-ci-tier-tests] + if: always() && !cancelled() + runs-on: ubuntu-latest + steps: + - name: Check CI Status + env: + CHANGES: ${{ needs.changes.result }} + REVIEW: ${{ needs.review-tests.result }} + CI_METRICS: ${{ needs.ci-metrics-tests.result }} + PLAN_CI_TIER: ${{ needs.plan-ci-tier-tests.result }} + RUN_REVIEW: ${{ needs.changes.outputs.review }} + RUN_CI_METRICS: ${{ needs.changes.outputs.ci_metrics }} + RUN_PLAN_CI_TIER: ${{ needs.changes.outputs.plan_ci_tier }} + run: | + failed=0 + expect() { # job, its result, whether it should run + if [[ "$3" == "true" && "$2" == "success" ]] || [[ "$3" != "true" && "$2" == "skipped" ]]; then + echo "✓ $1: $2" + else + echo "✗ $1: $2 (expected $([[ "$3" == "true" ]] && echo success || echo skipped))" + failed=1 + fi + } + expect "changes" "$CHANGES" true + expect "Review action tests" "$REVIEW" "$RUN_REVIEW" + expect "CIMetrics tests" "$CI_METRICS" "$RUN_CI_METRICS" + expect "PlanCITier tests" "$PLAN_CI_TIER" "$RUN_PLAN_CI_TIER" + exit $failed diff --git a/.github/workflows/plan-ci-tier-tests.yml b/.github/workflows/plan-ci-tier-tests.yml deleted file mode 100644 index 18ab21d..0000000 --- a/.github/workflows/plan-ci-tier-tests.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: PlanCITier tests - -on: - pull_request: - paths: [PlanCITier/**] - push: - branches: [main] - paths: [PlanCITier/**] - -permissions: - contents: read - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.2 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - run: node --test PlanCITier/ diff --git a/.github/workflows/review-tests.yml b/.github/workflows/review-tests.yml deleted file mode 100644 index 31391bf..0000000 --- a/.github/workflows/review-tests.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Review action tests - -on: - pull_request: - paths: [AssignReviewers/**, ReviewConfig/**, ReviewSLA/**] - push: - branches: [main] - paths: [AssignReviewers/**, ReviewConfig/**, ReviewSLA/**] - -permissions: - contents: read - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.2 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - run: node --test AssignReviewers/ ReviewConfig/ ReviewSLA/