Skip to content

Commit

Permalink
feat: Add retest workflow. Fixes #12864
Browse files Browse the repository at this point in the history
Signed-off-by: Miltiadis Alexis <[email protected]>
  • Loading branch information
miltalex committed May 1, 2024
1 parent ed55b02 commit a4dd27f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/retest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Detect and Trigger Retest
on:
issue_comment:
types: [created, edited]

jobs:
retest:
runs-on: ubuntu-latest
steps:
- name: Checkout
if: github.event.comment.author_association == 'MEMBER' && contains(github.event.comment.body, '/retest')
uses: actions/checkout@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Retest
if: github.event.comment.author_association == 'MEMBER' && contains(github.event.comment.body, '/retest')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
COMMENT: ${{ github.event.comment.body }}
run: |
gh pr checkout ${{ github.event.issue.number }}
SHA_REF=$(git rev-parse HEAD)
NAME="${COMMENT#*/retest}"
RUNID=$(gh api "repos/$REPO/actions/runs?event=pull_request&head_sha=$SHA_REF" | jq -r ".workflow_runs[] | select(.name == \"$NAME\") | .id"| head -n 1)
gh api --method POST repos/$REPO/actions/runs/$RUNID/rerun-failed-jobs

0 comments on commit a4dd27f

Please sign in to comment.