generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (42 loc) · 1.59 KB
/
comment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Run test-ring-1 on comment
on:
issue_comment:
types: [created, edited]
jobs:
comment_trigger:
runs-on: ubuntu-latest
outputs:
triggerTestRing1: ${{ steps.check_comment.outputs.result }}
headSha: ${{ steps.pr_info.outputs.headSha }}
headRef: ${{ steps.pr_info.outputs.headRef }}
steps:
- uses: actions/checkout@v4
- id: check_comment
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const comment = context.payload.comment.body.trim();
const startsWithTestRing1 = comment.startsWith('/test-ring-1');
console.log('Comment starts with "/test-ring-1":', startsWithTestRing1);
return startsWithTestRing1;
- id: pr_info
if: steps.check_comment.outputs.result == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
headInfo=$(gh pr view ${{ github.event.issue.number }} --json headRefName,headRefOid)
echo "Head Info: $headInfo"
echo "headSha=$(echo $headInfo | jq -r '.headRefOid')" >> $GITHUB_OUTPUT
echo "headRef=$(echo $headInfo | jq -r '.headRefName')" >> $GITHUB_OUTPUT
trigger-test-ring-1:
needs: comment_trigger
runs-on: ubuntu-latest
if: needs.comment_trigger.outputs.triggerTestRing1 == 'true'
steps:
- shell: bash
run: |
echo "Running test-ring-1"
echo "Head SHA: ${{ needs.comment_trigger.outputs.headSha }}"
echo "Head Ref: ${{ needs.comment_trigger.outputs.headRef }}"