-
Notifications
You must be signed in to change notification settings - Fork 104
48 lines (42 loc) · 1.37 KB
/
nightly.yml
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
48
name: "nightly"
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
spec:
runs-on: ubuntu-latest
steps:
- name: Check outcome
run: |
echo "Workflow succeeded"
exit 0
acceptance:
needs: "spec"
runs-on: ubuntu-latest
steps:
- name: Check outcome
run: |
echo "Workflow failed"
exit 1
on-failure-workflow-restarter-proxy:
# (1) run this job after the "acceptance" job and...
needs: [acceptance]
# (2) continue ONLY IF "acceptance" fails
if: always() && needs.acceptance.result == 'failure'
runs-on: ubuntu-latest
steps:
# (3) checkout this repository in order to "see" the following custom action
- name: Checkout repository
uses: actions/checkout@v2
# (4) "use" the custom action to retrigger the failed "acceptance job" above
# NOTE: pass the SOURCE_GITHUB_TOKEN to the custom action because (a) it must have
# this to trigger the reusable workflow that restarts the failed job; and
# (b) custom actions do not have access to the calling workflow's secrets
- name: Trigger reusable workflow
uses: ./.github/actions/workflow-restarter-proxy
env:
SOURCE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repository: ${{ github.repository }}
run_id: ${{ github.run_id }}