From 43abffad6d475db32f3b7603a3c0cf19e8471c75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Standa=20Nov=C3=A1k?= Date: Mon, 9 Dec 2024 13:45:55 +0100 Subject: [PATCH] chore: Check statuses of dependent jobs before merge (#2758) 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. --- .github/workflows/test.yml | 44 +++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9d1e37631b..c49c0929ca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 🎉"