Skip to content

Commit 3f22778

Browse files
committed
consolidate into a single step
1 parent 359658c commit 3f22778

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,29 +59,28 @@ jobs:
5959
uses: actions/checkout@v4
6060
- name: run action
6161
uses: ./
62+
id: action-run
6263
with:
6364
environment-paths: "${{ toJSON(matrix.env-paths) }}"
64-
- name: setup status
65+
- name: detect outcome
6566
if: always()
6667
shell: bash -l {0}
6768
run: |
68-
echo "${{ success() }} vs ${{ failure() }}"
69-
echo "STATUS=0" >> $GITHUB_ENV
70-
- name: detect unexpected failures
71-
if: |
72-
failure() && ${{ matrix.expected-failure }} == "false"
73-
shell: bash -l {0}
74-
run: |
75-
echo "unexpected failure"
76-
echo "STATUS=1" >> $GITHUB_ENV
77-
- name: detect unexpected passes
78-
if: |
79-
success() && ${{ matrix.expected-failure }} == "true"
80-
shell: bash -l {0}
81-
run: |
82-
echo "unexpected pass"
83-
echo "STATUS=2" >> $GITHUB_ENV
84-
- name: evaluate status
85-
shell: bash -l {0}
86-
run: |
69+
if [[ "${{ steps.action-run.outcome }}" == "success" && ${{ matrix.expected-failure }} == "true" ]]; then
70+
# unexpected failure
71+
echo "workflow xpassed"
72+
echo "STATUS=1" >> $GITHUB_ENV
73+
elif [[ "${{ steps.action-run.outcome }}" == "failure" && ${{ matrix.expected-failure }} == "false" ]]; then
74+
# unexpected pass
75+
echo "workflow failed"
76+
echo "STATUS=2" >> $GITHUB_ENV
77+
elif [[ "${{ steps.action-run.outcome }}" == "success" ]]; then
78+
# normal pass
79+
echo "passed"
80+
echo "STATUS=0" >> $GITHUB_ENV
81+
else
82+
# cancelled
83+
echo "workflow cancelled"
84+
echo "STATUS=3" >> $GITHUB_ENV
85+
fi
8786
exit ${{ env.STATUS }}

0 commit comments

Comments
 (0)