This PR adds support for discussion comments. Because the action.yml is getting big, I introduced a queries.sh file to move the GraphQL calls into, including the mutation call we introduced in https://github.com/github/accessibility-alt-text-bot/pull/14.
We are using the addDiscussionComment and setting the replyToId to post a comment as a reply in a thread.
When replying to a top-level discussion comment, we're able to use github.event.comment.node_id as the replyToId to post a reply successfully.
However, I ran into issues making the same call when replying to a discussion comment inside of a thread. I kept running into the error:
gh: Parent comment is already in a thread, cannot reply to it
I discovered that replyToId has to be a top-level/parent comment node id. Since the github.event.comment.node_id only contains the node ID of the comment we're replying to, we must make a GraphQL query to get the parent comment node ID. We do that in the function getDiscussionReplyToId.
:wave: Hello and thanks for pinging us! You've entered our first responder queue. An accessibility first responder will review this soon.
:computer: On PRs for our review: please provide a review environment with steps to validate, screenshots (with alt text), or videos demonstrating functionality we should be checking. This will help speed up our review and feedback cycle.
:warning: If this is urgent, please visit us in #accessibility on Slack and tag the first responder(s) listed in the channel topic.
Fixes: https://github.com/github/accessibility-alt-text-bot/issues/11
This PR adds support for discussion comments. Because the
action.yml
is getting big, I introduced aqueries.sh
file to move the GraphQL calls into, including the mutation call we introduced in https://github.com/github/accessibility-alt-text-bot/pull/14.We are using the
addDiscussionComment
and setting thereplyToId
to post a comment as a reply in a thread.When replying to a top-level discussion comment, we're able to use
github.event.comment.node_id
as thereplyToId
to post a reply successfully.However, I ran into issues making the same call when replying to a discussion comment inside of a thread. I kept running into the error:
I discovered that
replyToId
has to be a top-level/parent comment node id. Since thegithub.event.comment.node_id
only contains the node ID of the comment we're replying to, we must make a GraphQL query to get the parent comment node ID. We do that in the functiongetDiscussionReplyToId
.