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 2, 2024
1 parent ed55b02 commit 9d2ace5
Showing 1 changed file with 24 additions and 0 deletions.
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]

permissions:
contents: read

jobs:
retest:
runs-on: ubuntu-latest
if: github.event.comment.author_association == 'MEMBER' && github.event.comment.body == '/retest'
permissions:
actions: write
steps:
- name: Retest
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?per_page=1" | jq -r '.[].sha')
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')
gh api --method POST repos/$REPO/actions/runs/$RUN_ID/rerun-failed-jobs

0 comments on commit 9d2ace5

Please sign in to comment.