From c7f4c28db2080426425e15bae13ecf24a29a7326 Mon Sep 17 00:00:00 2001 From: Ludvig Liljenberg Date: Thu, 6 Mar 2025 10:06:53 -0800 Subject: [PATCH] Add a specific CI job on which we can gate PRs. This is needed because gating on specific skippable jobs does not work when those jobs are skipped (for example during docs-only PRs) Signed-off-by: Ludvig Liljenberg --- .github/workflows/ValidatePullRequest.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/ValidatePullRequest.yml b/.github/workflows/ValidatePullRequest.yml index c1ddc525f..5015679a8 100644 --- a/.github/workflows/ValidatePullRequest.yml +++ b/.github/workflows/ValidatePullRequest.yml @@ -66,3 +66,24 @@ jobs: - uses: actions/checkout@v4 - name: Spell Check Repo uses: crate-ci/typos@v1.29.10 + + # Gate PR merges on this specific "join-job" which requires all other + # jobs to run first. We need this job since we cannot gate on particular jobs + # in the workflow, since they can sometimes be skipped (e.g. if the PR only touches docs). + # This step fixes this issue by always running. + report-ci-status: + needs: + - docs-pr + - rust + - fuzzing + - spelling + if: always() + runs-on: ubuntu-latest + steps: + - name: Previous jobs succeeded + if: ${{ !(contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }} + run: exit 0 + - name: Previous jobs failed + if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} + run: exit 1 + \ No newline at end of file