From 83af508adec76be84a5877f624b7c6f1681bd8df Mon Sep 17 00:00:00 2001 From: Renan Franca Date: Tue, 12 Nov 2024 13:01:23 -0300 Subject: [PATCH] fix: use trap command to ensure that the ./stop script is called on exit of the step name Generation: generate ${{ matrix.app }} from main branch --- .github/workflows/github-actions.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 9bbbf12fcea..963f7b33f25 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -289,12 +289,15 @@ jobs: - name: 'Generation: generate ${{ matrix.app }} from main branch' if: github.event_name == 'pull_request' working-directory: ./main-branch/tests-ci/ - continue-on-error: true # Allow the step to continue even if generate.sh fails + continue-on-error: true id: generate-main run: | + # Set up trap to ensure stop.sh is called on exit + trap './stop.sh' EXIT + ./start.sh 7471 - (./generate.sh ${{ matrix.app }} ${{ matrix.java-build-tool }} ${{ matrix.spring-config-format }}; GENERATE_EXIT_CODE=$?) - ./stop.sh + ./generate.sh ${{ matrix.app }} ${{ matrix.java-build-tool }} ${{ matrix.spring-config-format }} + GENERATE_EXIT_CODE=$? echo "exit_code=$GENERATE_EXIT_CODE" >> $GITHUB_OUTPUT exit $GENERATE_EXIT_CODE - name: 'Generation: calculate md5sum ${{ matrix.app }} from main branch'