-
-
Notifications
You must be signed in to change notification settings - Fork 160
29 lines (26 loc) · 922 Bytes
/
rerun-failed.yml
File metadata and controls
29 lines (26 loc) · 922 Bytes
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
name: Rerun failed
on:
workflow_run:
workflows:
- Tests
types:
- completed
jobs:
on-failure:
runs-on: ubuntu-22.04
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- name: Check if OpenSearch failed to start
id: check-opensearch
run: |
jobs=$(gh api ${{ github.event.workflow_run.jobs_url }})
failed=$(echo "${jobs}" | jq '.jobs | any(.steps | any((.name == "Wait for open search to become ready" or .name == "Setup Exercism services") and .conclusion == "failure"))')
echo "failed=${failed}" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}
- name: Rerun job
if: ${{ steps.check-opensearch.outputs.failed == 'true' }}
run: |
gh api --method POST ${{ github.event.workflow_run.rerun_url }}
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOWS_PAT }}