Skip to content

Commit e63d39f

Browse files
Vivek Miglanifacebook-github-bot
authored andcommitted
Update Captum rerun workflow to operate directly on workflow completion (#1410)
Summary: Pull Request resolved: #1410 The initial rerun workflow cannot be triggered successfully for PRs created from forks, since the GitHub auth token provided for PRs on forks doesn't provide write access. This switches to a workflow completion trigger, which should run from the main repo and have write access to rerun the workflow. Reviewed By: craymichael Differential Revision: D64760527 fbshipit-source-id: 50163f52007153696baddee45a17f0a7aeb08fb3
1 parent 1ba8977 commit e63d39f

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

.github/workflows/retry.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
1-
name: Retry Test
1+
name: Rerun tests if failed
22
on:
3-
workflow_dispatch:
4-
inputs:
5-
run_id:
6-
required: true
3+
workflow_run:
4+
workflows: ["Unit-tests for Conda install", "Unit-tests for Pip install with mypy type checks", "Unit-tests for Pip install"]
5+
types: ["completed"]
6+
7+
permissions:
8+
actions: write
9+
710
jobs:
8-
rerun-on-failure:
9-
permissions: write-all
11+
rerun-tests:
1012
runs-on: ubuntu-latest
1113
steps:
12-
- name: rerun ${{ inputs.run_id }}
14+
- name: Log workflow metadata
15+
run: |
16+
echo "ID: ${{ github.event.workflow_run.id }}"
17+
echo "attempt: ${{ github.event.workflow_run.run_attempt }}"
18+
echo "event: ${{ github.event.workflow_run.conclusion }}"
19+
echo "event: ${{ github.event.workflow_run.event }}"
20+
- name: Rerun Failed Workflows
21+
if: github.event.workflow_run.conclusion == 'failure' && github.event.run_attempt <= 3
1322
env:
14-
GH_REPO: ${{ github.repository }}
1523
GH_TOKEN: ${{ github.token }}
16-
GH_DEBUG: api
24+
RUN_ID: ${{ github.event.workflow_run.id }}
1725
run: |
18-
gh run watch ${{ inputs.run_id }} > /dev/null 2>&1
19-
gh run rerun ${{ inputs.run_id }} --failed
26+
gh run rerun ${RUN_ID} --repo="${{ github.repository }}" --failed

0 commit comments

Comments
 (0)