Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): Add retest workflow. Fixes #12864 #13000

Merged
merged 1 commit into from
May 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/retest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Detect and Trigger Retest
on:
issue_comment:
types: [created, edited]

agilgur5 marked this conversation as resolved.
Show resolved Hide resolved
permissions:
contents: read

jobs:
retest:
if: github.event.comment.author_association == 'MEMBER' && github.event.comment.body == '/retest'
permissions:
actions: write # for re-running failed jobs: https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#re-run-a-job-from-a-workflow-run
runs-on: ubuntu-latest
steps:
- name: Re-run failed jobs for this PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.issue.number }}
run: |
SHA_REF=$(gh api "/repos/$REPO/pulls/$PR_NUMBER/commits" | jq -r '.[].sha' | tail -n 1)
RUN_ID=$(gh api "repos/$REPO/actions/workflows/ci-build.yaml/runs?per_page=1&event=pull_request&head_sha=$SHA_REF" | jq -r '.workflow_runs[] | .id)
agilgur5 marked this conversation as resolved.
Show resolved Hide resolved
gh api --method POST repos/$REPO/actions/runs/$RUN_ID/rerun-failed-jobs
Loading