Skip to content

Commit 487b470

Browse files
committed
Add support for discussion comment
1 parent 78defe3 commit 487b470

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.github/workflows/test-accessibility-alt-text-bot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
types: [created, edited]
99
discussion:
1010
types: [created, edited]
11+
discussion_comment:
12+
types: [created, edited]
1113

1214
jobs:
1315
accessibility_alt_text_bot:

action.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ runs:
1212
1313
if [ ${{ github.event.comment }} ]; then
1414
content=$COMMENT
15-
issue_url=${{ github.event.issue.html_url }}
1615
user=${{ github.event.comment.user.login }}
1716
if ${{ github.event.issue.pull_request.url != '' }}; then
1817
type=pr_comment
18+
issue_url=${{ github.event.issue.html_url }}
19+
elif ${{ github.event.discussion.id != '' }}; then
20+
type=discussion_comment
21+
discussion_node_id='${{ github.event.discussion.node_id }}'
22+
reply_to_id='${{ github.event.comment.node_id }}'
1923
else
2024
type=issue_comment
25+
issue_url=${{ github.event.issue.html_url }}
2126
fi
2227
target=${{ github.event.comment.html_url }}
2328
else
@@ -66,6 +71,16 @@ runs:
6671
}
6772
}
6873
'
74+
elif [[ $type = discussion_comment ]]; then
75+
gh api graphql -F discussionId="$discussion_node_id" -F replyToId="$reply_to_id" -F body="$message" -f query='
76+
mutation($discussionId: ID!, , $replyToId: ID, $body: String!) {
77+
addDiscussionComment(input: {discussionId: $discussionId, replyToId: $replyToId, body: $body}) {
78+
comment {
79+
id
80+
}
81+
}
82+
}
83+
'
6984
fi
7085
fi
7186
shell: bash

0 commit comments

Comments
 (0)