File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 1
1
name : Accessibility alt text bot
2
- description : ' This action will check a repos issue and pr comments for correct alt text usage.'
2
+ description : ' This action will check a repos issue, discussion, or PR for correct alt text usage.'
3
3
branding :
4
4
icon : ' eye'
5
5
color : ' purple'
28
28
comment_owner=${{ github.event.pull_request.user.login }}
29
29
is_pr=true
30
30
target=" your pull request body"
31
+ elif [ ${{ github.event.discussion && !github.event.comment }} ]; then
32
+ comment='${{ github.event.discussion.body }}'
33
+ discussion_node_id='${{ github.event.discussion.node_id }}'
34
+ comment_owner=${{ github.event.discussion.user.login }}
35
+ target='your discussion description'
36
+ is_discussion=true
31
37
fi
32
38
message="Uh oh! @$comment_owner, the image you shared is missing helpful alt text. Check $target.
33
39
38
44
if [[ $flag = true ]]; then
39
45
if [[ $is_pr = true ]]; then
40
46
gh pr comment $issue --body "$message"
47
+ elif [[ $is_discussion = true ]]; then
48
+ gh api graphql -F discussionId="$discussion_node_id" -F body="$message" -f query='
49
+ mutation($discussionId: ID!, $body: String!, $replyToId: ID) {
50
+ addDiscussionComment(input: {discussionId: $discussionId, body: $body}) {
51
+ comment {
52
+ id
53
+ }
54
+ }
55
+ }
56
+ '
41
57
else
42
58
gh issue comment $issue --body "$message"
43
59
fi
You can’t perform that action at this time.
0 commit comments