Skip to content

Commit

Permalink
chore: Check statuses of dependent jobs before merge (#2758)
Browse files Browse the repository at this point in the history
When some jobs not succeed, the `Everything passed` job gets skipped
which is taken as a success by github actions.

This change checks the statuses of the dependent jobs, making the last
check failing if something before fails.
  • Loading branch information
StaNov authored Dec 9, 2024
1 parent d4b6931 commit 43abffa
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -467,5 +467,47 @@ jobs:
- e2e-code-checks
- e2e-install-deps
runs-on: ubuntu-latest
if: always()
steps:
- run: echo "Everything passed 🎉"
- run: |
# Check the results of all jobs
failed_jobs=()
if [[ "${{ needs.backend-build.result }}" != "success" ]]; then
failed_jobs+=("backend-build")
fi
if [[ "${{ needs.backend-test.result }}" != "success" ]]; then
failed_jobs+=("backend-test")
fi
if [[ "${{ needs.backend-code-checks.result }}" != "success" ]]; then
failed_jobs+=("backend-code-checks")
fi
if [[ "${{ needs.frontend-build.result }}" != "success" ]]; then
failed_jobs+=("frontend-build")
fi
if [[ "${{ needs.frontend-code-check.result }}" != "success" ]]; then
failed_jobs+=("frontend-code-check")
fi
if [[ "${{ needs.e2e.result }}" != "success" ]]; then
failed_jobs+=("e2e")
fi
if [[ "${{ needs.e2e-code-checks.result }}" != "success" ]]; then
failed_jobs+=("e2e-code-checks")
fi
if [[ "${{ needs.e2e-install-deps.result }}" != "success" ]]; then
failed_jobs+=("e2e-install-deps")
fi
if [[ "${#failed_jobs[@]}" -gt 0 ]]; then
echo "The following jobs failed: ${failed_jobs[*]}"
exit 1
fi
echo "Everything passed 🎉"

0 comments on commit 43abffa

Please sign in to comment.