From dd63d61a5927683195fd03f6689dfd1304d4d882 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Thu, 14 Aug 2025 17:44:10 -0700 Subject: [PATCH] fix: trying to simplify rust-ci.yml (#2327) It turns out that https://github.com/openai/codex/pull/2324 did not quite work as intended. Chat's new idea is to have this catch-all "CI results" job and update our branch protection rules to require this instead. --- .github/workflows/rust-ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index 1861233abf..fd8340a083 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -69,6 +69,7 @@ jobs: runs-on: ${{ matrix.runner }} timeout-minutes: 30 needs: changed + # Keep job-level if to avoid spinning up runners when not needed if: ${{ needs.changed.outputs.codex == 'true' || needs.changed.outputs.workflows == 'true' || github.event_name == 'push' }} defaults: run: @@ -166,3 +167,27 @@ jobs: run: | echo "One or more checks failed (clippy, build, or test). See logs for details." exit 1 + + # --- Gatherer job that you mark as the ONLY required status ----------------- + results: + name: CI results (required) + needs: [changed, general, lint_build_test] + if: always() + runs-on: ubuntu-24.04 + steps: + - name: Summarize + shell: bash + run: | + echo "general: ${{ needs.general.result }}" + echo "matrix : ${{ needs.lint_build_test.result }}" + + # If nothing relevant changed (PR touching only root README, etc.), + # declare success regardless of other jobs. + if [[ '${{ needs.changed.outputs.codex }}' != 'true' && '${{ needs.changed.outputs.workflows }}' != 'true' && '${{ github.event_name }}' != 'push' ]]; then + echo 'No relevant changes -> CI not required.' + exit 0 + fi + + # Otherwise require the jobs to have succeeded + [[ '${{ needs.general.result }}' == 'success' ]] || { echo 'general failed'; exit 1; } + [[ '${{ needs.lint_build_test.result }}' == 'success' ]] || { echo 'matrix failed'; exit 1; }