-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (37 loc) · 1.11 KB
/
example_error_handling.yaml
File metadata and controls
47 lines (37 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Example - Error Handling
on:
workflow_dispatch:
env:
SPRITES_TOKEN: ${{ secrets.SPRITES_TOKEN }}
jobs:
error-handling:
name: Error Handling
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Init Sprite
id: init
uses: ./init
- name: Successful step
id: success-step
uses: ./run
with:
step-key: success
run: echo "This should succeed"
- name: Failing step (expected)
id: fail-step
uses: ./run
continue-on-error: true
with:
step-key: failure
run: exit 1
- name: Verify failure was captured
run: |
echo "Exit code: ${{ steps.fail-step.outputs.exit-code }}"
# Should have non-zero exit code
test "${{ steps.fail-step.outputs.exit-code }}" = "1" || exit 1
# Should not have created a checkpoint
test -z "${{ steps.fail-step.outputs.checkpoint-id }}" || test "${{ steps.fail-step.outputs.checkpoint-id }}" = "" || exit 1
- name: Cleanup Sprite
if: always()
uses: ./clean