|
9 | 9 | - name: Runs alt text check and adds comment
|
10 | 10 | run: |
|
11 | 11 | source ${{ github.action_path }}/flag-alt-text.sh
|
| 12 | + source ${{ github.action_path }}/queries.sh |
12 | 13 |
|
13 | 14 | if [ ${{ github.event.comment }} ]; then
|
14 | 15 | content=$COMMENT
|
|
19 | 20 | elif ${{ github.event.discussion.id != '' }}; then
|
20 | 21 | type=discussion_comment
|
21 | 22 | discussion_node_id='${{ github.event.discussion.node_id }}'
|
22 |
| - reply_to_id='${{ github.event.comment.node_id }}' |
| 23 | + comment_node_id='${{ github.event.comment.node_id }}' |
| 24 | + if ${{ github.event.comment.parent_id != '' }}; then |
| 25 | + reply_to_id=$(getDiscussionReplyToId $comment_node_id) |
| 26 | + else |
| 27 | + reply_to_id=$comment_node_id |
| 28 | + fi |
23 | 29 | else
|
24 | 30 | type=issue_comment
|
25 | 31 | issue_url=${{ github.event.issue.html_url }}
|
|
62 | 68 | elif [[ $type = issue_comment ]] || [[ $type = issue_description ]]; then
|
63 | 69 | gh issue comment $issue_url --body "$message"
|
64 | 70 | elif [[ $type = discussion_description ]]; then
|
65 |
| - gh api graphql -F discussionId="$discussion_node_id" -F body="$message" -f query=' |
66 |
| - mutation($discussionId: ID!, $body: String!) { |
67 |
| - addDiscussionComment(input: {discussionId: $discussionId, body: $body}) { |
68 |
| - comment { |
69 |
| - id |
70 |
| - } |
71 |
| - } |
72 |
| - } |
73 |
| - ' |
| 71 | + addDiscussionComment $discussion_node_id "$message" |
74 | 72 | 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 |
| - ' |
| 73 | + addDiscussionCommentAsReply $discussion_node_id $reply_to_id "$message" |
84 | 74 | fi
|
85 | 75 | fi
|
86 | 76 | shell: bash
|
|
0 commit comments