-
-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (40 loc) · 1.49 KB
/
slash_ops_comment_dispatch.yml
File metadata and controls
43 lines (40 loc) · 1.49 KB
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
---
name: PR commented
on:
issue_comment:
types:
- created
jobs:
slash-command-dispatch:
runs-on: ubuntu-latest
steps:
# Get the branch name
- name: Get the target branch name
id: vars
run: |
branch=${{ github.event.client_payload.slash_command.args.named.branch }}
if [[ -z "$branch" ]]; then branch="main"; fi
echo "branch=$branch" >> $GITHUB_OUTPUT
- uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 # v6.4.0
id: comment-metadata
with:
script: |
result = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.issue.number
})
echo "::set-output name=pull_request_number::${context.payload.issue.number}"
echo "branch_name=${result.data.head.ref}" >> $GITHUB_OUTPUT
echo "pull_request_number=${context.payload.issue.number}" >> $GITHUB_OUTPUT
- name: Slash Command Dispatch
uses: peter-evans/slash-command-dispatch@a28ee6cd74d5200f99e247ebc7b365c03ae0ef3c # v3
with:
token: ${{ secrets.LINT_PR_GH_TOKEN }}
issue-type: pull-request
static-args: |
branch_name=${{ steps.comment-metadata.outputs.branch_name }}
pull_request_number=${{ steps.comment-metadata.outputs.pull_request_number }}
commands: |
help
finish