-
Notifications
You must be signed in to change notification settings - Fork 1.3k
31 lines (28 loc) · 1.08 KB
/
deflake.yaml
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
name: Deflake Tests
# Runs when the Selenum lab test or PR test workflows complete. This will run
# with full privileges, even if the other workflow doesn't. That allows us to
# trigger re-runs if we think the results might be flaky. A test run will be
# given up to 3 runs to succeed.
on:
workflow_run:
workflows:
- Selenium Lab Tests
- Build and Test PR
types: [completed]
jobs:
deflake:
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
runs-on: ubuntu-latest
steps:
- name: Check run count and re-run workflow
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api /repos/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }} > run.json
RUNS=$(jq -r .run_attempt < run.json)
if [[ "$RUNS" -lt 3 ]]; then
echo "$RUNS failed runs so far; re-running workflow."
gh run rerun ${{ github.event.workflow_run.id }} --failed -R ${{ github.repository }}
else
echo "$RUNS failed runs so far; not re-running workflow."
fi