forked from ivy-llc/ivy
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (44 loc) · 1.37 KB
/
label_discussion_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: Label New Discussion Comment
on:
discussion_comment:
types: [created]
jobs:
label_discussion:
name: Label Unread Discussion
runs-on: ubuntu-latest
steps:
- name: Checks
uses: actions/checkout@v2
with:
path: ivy
persist-credentials: false
- name: Get label_id
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORGANIZATION: unifyai
REPOSITORY: ivy
LABEL_NAME: "Unanswered"
run: |
gh api -H "Accept: application/vnd.github.v3+json" /repos/$ORGANIZATION/$REPOSITORY/labels/$LABEL_NAME > label_data.json
echo 'LABEL_ID='$(jq '.node_id' label_data.json) >> $GITHUB_ENV
- name: Add label to discussion
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DISCUSSION_ID: ${{ github.event.discussion.node_id }}
run: |
gh api graphql -f query='
mutation (
$label_ids: [ID!]!
$labelable_id: ID!
) {
set_label: addLabelsToLabelable(input: {
labelIds: $label_ids
labelableId: $labelable_id
}) {
labelable {
labels {
totalCount
}
}
}
}' -f label_ids=$LABEL_ID -f labelable_id=$DISCUSSION_ID --silent