Skip to content

Commit 6266df7

Browse files
committed
ci: add /test comment trigger for PRs
1 parent 852b47c commit 6266df7

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Comment Trigger
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
permissions:
8+
actions: write
9+
pull-requests: read
10+
11+
jobs:
12+
trigger-test:
13+
if: github.event.issue.pull_request != null && github.event.comment.body == '/test'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Get PR branch
17+
id: pr
18+
env:
19+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
run: |
21+
BRANCH=$(gh pr view ${{ github.event.issue.number }} --repo ${{ github.repository }} --json headRefName --jq '.headRefName')
22+
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
23+
24+
- name: Trigger test workflow
25+
env:
26+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
run: |
28+
gh workflow run test.yml --ref "${{ steps.pr.outputs.branch }}"

0 commit comments

Comments
 (0)