diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9807b93..4857210 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -70,3 +70,25 @@ jobs: - name: Run cargo audit run: cargo audit + + # https://github.com/orgs/community/discussions/12395#discussioncomment-12970019 + check-workflow-status: + name: Check Workflow Status + runs-on: ubuntu-latest + needs: + - linter + - tests + - audit + if: always() + steps: + - name: Check Workflow Status + run: | + exit_on_result() { + if [[ "$2" == "failure" || "$2" == "cancelled" ]]; then + echo "Job '$1' failed or was cancelled." + exit 1 + fi + } + exit_on_result "linter" "${{ needs.linter.result }}" + exit_on_result "tests" "${{ needs.tests.result }}" + exit_on_result "audit" "${{ needs.audit.result }}"