-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (45 loc) · 1.45 KB
/
issue_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
46
47
48
49
50
#
name: Invoke PR comment Workflow
on:
issue_comment:
types:
- created
# branches:
# - master
# - main
# - develop
jobs:
invoke-pr-comment-workflow:
runs-on: ubuntu-latest
steps:
- name: Work out branch we are on
id: branch
run: |
REF=$(gh pr view ${{ github.event.issue.number }} -R alongwill/${GITHUB_REPOSITORY##*/} --json headRefName -q '.headRefName')
# When run from a PR this will show main/master
echo "branch_name=${REF}" >> ${GITHUB_ENV}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Debug values
run: |
echo "branch_ref = $branch_name (from gh cli)"
echo "branch = ${GITHUB_REF##*/} (from GITHUB_REF)"
echo "issue_number = ${{ github.event.issue.number }}"
- name: Dump GitHub context to use for local testing
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
echo "$GITHUB_CONTEXT"
- name: Invoke shared Ephemeral Workflow
uses: actions/github-script@v6
env:
branch_ref: ${{ env.branch_name }}
with:
script: |-
console.log(context);
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Action succeeded! ✅ ',
});