From e315976e82d0ac76a1896a25926a9cbd48da9c73 Mon Sep 17 00:00:00 2001 From: NickGraham101 Date: Thu, 3 Mar 2022 11:07:44 +0000 Subject: [PATCH 1/7] Added input for step two exit code --- .github/actions/parse-context-array/action.yml | 6 +++++- .github/workflows/parse-context-array.yml | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/actions/parse-context-array/action.yml b/.github/actions/parse-context-array/action.yml index a9a82e1..ebdd0de 100644 --- a/.github/actions/parse-context-array/action.yml +++ b/.github/actions/parse-context-array/action.yml @@ -1,6 +1,10 @@ name: parse-context-array description: Parse Context Array +inputs: + step-two-exit-code: + required: true + runs: using: composite steps: @@ -12,7 +16,7 @@ runs: - name: step two id: step-two shell: bash - run: exit 0 + run: exit ${{ inputs.step-two-exit-code }} - name: Evaluate job one status if: always() diff --git a/.github/workflows/parse-context-array.yml b/.github/workflows/parse-context-array.yml index c903242..1a4a7eb 100644 --- a/.github/workflows/parse-context-array.yml +++ b/.github/workflows/parse-context-array.yml @@ -1,6 +1,12 @@ name: ParseContextArray -on: [push] +on: + workflow_dispatch: + inputs: + step-two-exit-code: + type: number + default: 0 + push: jobs: test: From ac3f6a23033aa497ad3e03b43a13f14f09aae3b0 Mon Sep 17 00:00:00 2001 From: NickGraham101 Date: Thu, 3 Mar 2022 11:15:36 +0000 Subject: [PATCH 2/7] Added missing with --- .github/workflows/parse-context-array.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/parse-context-array.yml b/.github/workflows/parse-context-array.yml index 1a4a7eb..7ef86ee 100644 --- a/.github/workflows/parse-context-array.yml +++ b/.github/workflows/parse-context-array.yml @@ -18,3 +18,5 @@ jobs: - name: Parse Context Array uses: ./.github/actions/parse-context-array/ + with: + step-two-exit-code: ${{ github.event.inputs.step-two-exit-code }} From b520f7800d0e09d653c4dcedc792934fb3de6639 Mon Sep 17 00:00:00 2001 From: NickGraham101 Date: Thu, 3 Mar 2022 11:24:15 +0000 Subject: [PATCH 3/7] Removed step env var mapping --- .github/actions/parse-context-array/action.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/actions/parse-context-array/action.yml b/.github/actions/parse-context-array/action.yml index ebdd0de..40516c7 100644 --- a/.github/actions/parse-context-array/action.yml +++ b/.github/actions/parse-context-array/action.yml @@ -18,25 +18,22 @@ runs: shell: bash run: exit ${{ inputs.step-two-exit-code }} - - name: Evaluate job one status + - name: Echo job statuses if: always() shell: bash run: | - echo $STEP_OUTCOMES - env: - STEP_OUTCOMES: ${{ steps.step-one.outcome }} + echo ${{ steps.step-one.outcome }} + echo ${{ steps.step-two.outcome }} - name: Evaluate job status if: always() shell: bash run: | - if [ $STEP_OUTCOMES =~ "failure" ]; then + if [ ${{ join(steps.*.outcome, ',') }} =~ "failure" ]; then echo JOB_STATUS="failure" >> $GITHUB_ENV; else echo JOB_STATUS="success" >> $GITHUB_ENV; fi; - env: - STEP_OUTCOMES: ${{ join(steps.*.outcome, ',') }} - name: Report job status if: always() From 5c34fabd5125a49d56f4d286d20365005d850a92 Mon Sep 17 00:00:00 2001 From: NickGraham101 Date: Thu, 3 Mar 2022 11:29:53 +0000 Subject: [PATCH 4/7] Mapped steps outcome to var in step --- .github/actions/parse-context-array/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/parse-context-array/action.yml b/.github/actions/parse-context-array/action.yml index 40516c7..92042ff 100644 --- a/.github/actions/parse-context-array/action.yml +++ b/.github/actions/parse-context-array/action.yml @@ -29,7 +29,8 @@ runs: if: always() shell: bash run: | - if [ ${{ join(steps.*.outcome, ',') }} =~ "failure" ]; then + JOB_STATUS=${{ join(steps.*.outcome, ',') }} + if [ $JOB_STATUS =~ "failure" ]; then echo JOB_STATUS="failure" >> $GITHUB_ENV; else echo JOB_STATUS="success" >> $GITHUB_ENV; From 74fcef0df6c51cf0ab99636a4f7631555f941b0a Mon Sep 17 00:00:00 2001 From: NickGraham101 Date: Thu, 3 Mar 2022 11:32:30 +0000 Subject: [PATCH 5/7] Wrapped local var in double quotes --- .github/actions/parse-context-array/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/parse-context-array/action.yml b/.github/actions/parse-context-array/action.yml index 92042ff..cd69568 100644 --- a/.github/actions/parse-context-array/action.yml +++ b/.github/actions/parse-context-array/action.yml @@ -29,7 +29,7 @@ runs: if: always() shell: bash run: | - JOB_STATUS=${{ join(steps.*.outcome, ',') }} + JOB_STATUS="${{ join(steps.*.outcome, ',') }}" if [ $JOB_STATUS =~ "failure" ]; then echo JOB_STATUS="failure" >> $GITHUB_ENV; else From 95d9c44ba4fd1fe0cf912a44486b835c4066ef7c Mon Sep 17 00:00:00 2001 From: NickGraham101 Date: Thu, 3 Mar 2022 11:38:50 +0000 Subject: [PATCH 6/7] Use double square brackets in condition --- .github/actions/parse-context-array/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/parse-context-array/action.yml b/.github/actions/parse-context-array/action.yml index cd69568..463a02f 100644 --- a/.github/actions/parse-context-array/action.yml +++ b/.github/actions/parse-context-array/action.yml @@ -30,7 +30,7 @@ runs: shell: bash run: | JOB_STATUS="${{ join(steps.*.outcome, ',') }}" - if [ $JOB_STATUS =~ "failure" ]; then + if [[ $JOB_STATUS =~ "failure" ]]; then echo JOB_STATUS="failure" >> $GITHUB_ENV; else echo JOB_STATUS="success" >> $GITHUB_ENV; From 267d34f89a861e6f450e4ffcce14c42a1035f88c Mon Sep 17 00:00:00 2001 From: NickGraham101 Date: Thu, 3 Mar 2022 11:42:45 +0000 Subject: [PATCH 7/7] Removed locally set variable --- .github/actions/parse-context-array/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/parse-context-array/action.yml b/.github/actions/parse-context-array/action.yml index 463a02f..0e9dc12 100644 --- a/.github/actions/parse-context-array/action.yml +++ b/.github/actions/parse-context-array/action.yml @@ -29,8 +29,7 @@ runs: if: always() shell: bash run: | - JOB_STATUS="${{ join(steps.*.outcome, ',') }}" - if [[ $JOB_STATUS =~ "failure" ]]; then + if [[ ${{ join(steps.*.outcome, ',') }} =~ "failure" ]]; then echo JOB_STATUS="failure" >> $GITHUB_ENV; else echo JOB_STATUS="success" >> $GITHUB_ENV;