-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
43 lines (36 loc) · 1.41 KB
/
action.yml
File metadata and controls
43 lines (36 loc) · 1.41 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: 'Create Discussion Comment'
description: 'Create Comments on Exsiting GitHub Discussions using GitHub Actions'
author: 'Wesley Scholl'
branding:
icon: message-square
color: green
inputs:
token:
description: "GitHub Token or PAT"
required: true
body:
description: "Comment Body String"
required: false
default: "Comment provided by GitHub Action create-discussion-comment"
discussion-id:
description: "Discussion topic ID"
required: true
client-mutation-id:
description: "Client Mutation ID - This should be unique"
required: false
default: "1234"
runs:
using: "composite"
steps:
- name: Checkout Actions Repo
uses: actions/checkout@v2
- name: Add Discussion Comment
shell: bash
id: discusscomment
run: |
RESPONSE=$(curl -v -X POST -H "Authorization: bearer ${{inputs.token}}" -H "Content-Type: application/json" -d '{"query": "mutation { addDiscussionComment(input: {body: \"${{inputs.body}}\" discussionId: \"${{inputs.discussion-id}}\" clientMutationId: \"${{inputs.client-mutation-id}}\"}) { clientMutationId comment { id body } } }"}' https://api.github.com/graphql)
echo $RESPONSE
echo "Comment ID:"
echo $RESPONSE | jq -r '.data.addDiscussionComment.comment.id'
echo "Comment Body:"
echo $RESPONSE | jq -r '.data.addDiscussionComment.comment.body'