Skip to content

Commit

Permalink
Update Captum rerun workflow to operate directly on workflow completi…
Browse files Browse the repository at this point in the history
…on (pytorch#1410)

Summary:
Pull Request resolved: pytorch#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
  • Loading branch information
Vivek Miglani authored and facebook-github-bot committed Oct 22, 2024
1 parent 1ba8977 commit e63d39f
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions .github/workflows/retry.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
name: Retry Test
name: Rerun tests if failed
on:
workflow_dispatch:
inputs:
run_id:
required: true
workflow_run:
workflows: ["Unit-tests for Conda install", "Unit-tests for Pip install with mypy type checks", "Unit-tests for Pip install"]
types: ["completed"]

permissions:
actions: write

jobs:
rerun-on-failure:
permissions: write-all
rerun-tests:
runs-on: ubuntu-latest
steps:
- name: rerun ${{ inputs.run_id }}
- name: Log workflow metadata
run: |
echo "ID: ${{ github.event.workflow_run.id }}"
echo "attempt: ${{ github.event.workflow_run.run_attempt }}"
echo "event: ${{ github.event.workflow_run.conclusion }}"
echo "event: ${{ github.event.workflow_run.event }}"
- name: Rerun Failed Workflows
if: github.event.workflow_run.conclusion == 'failure' && github.event.run_attempt <= 3
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
GH_DEBUG: api
RUN_ID: ${{ github.event.workflow_run.id }}
run: |
gh run watch ${{ inputs.run_id }} > /dev/null 2>&1
gh run rerun ${{ inputs.run_id }} --failed
gh run rerun ${RUN_ID} --repo="${{ github.repository }}" --failed

0 comments on commit e63d39f

Please sign in to comment.