Skip to content

Add support for validating discussion description #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 22, 2023

Conversation

khiga8
Copy link
Contributor

@khiga8 khiga8 commented May 19, 2023

Part of: #11

elif [[ $is_discussion = true ]]; then
gh api graphql -F discussionId="$discussion_node_id" -F body="$message" -f query='
mutation($discussionId: ID!, $body: String!) {
addDiscussionComment(input: {discussionId: $discussionId, body: $body}) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replyToId (The Node ID of the discussion comment within this discussion to reply to.) might be useful when we add discussion comments

@khiga8
Copy link
Contributor Author

khiga8 commented May 19, 2023

Doing some minor refactors for readability! Please hold!

action.yml Outdated
target=" your pull request body"
elif [ ${{ github.event.discussion && !github.event.comment }} ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only thought is since this is the only option using graphql what if we just moved the graphql command into this if statement?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will want to make this call based on the result of flag="$(flagAltText "$content")" which happens later! So I think we should keep the graphql command where it is!

I did some additional refactors which may help with readability.

comment_owner=${{ github.event.pull_request.user.login }}
is_pr=true
target=" your pull request body"
else
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can assume that else will be anything that's not a comment event, instead of having the check in every elif:

elif [ ${{ github.event.issue && !github.event.comment }} ];

issue=${{ github.event.issue.html_url }}
comment_owner=${{ github.event.comment.user.login }}
is_pr=${{ github.event.issue.pull_request.url != '' }}
content=$COMMENT
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed comment to content and comment_owner to user, since comment might be confusing given it's association with github.event.comment. We're setting these variables for non-comment events too.

comment=$COMMENT
issue=${{ github.event.issue.html_url }}
comment_owner=${{ github.event.comment.user.login }}
is_pr=${{ github.event.issue.pull_request.url != '' }}
Copy link
Contributor Author

@khiga8 khiga8 May 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this is_pr variable to be type, and set to one of:

  • issue_description
  • issue_comment
  • pr_description
  • pr_comment
  • discussion_description

I think this will make what we're dealing with more clear.

@khiga8 khiga8 marked this pull request as ready for review May 22, 2023 16:36
@khiga8 khiga8 requested a review from a team as a code owner May 22, 2023 16:36
@khiga8 khiga8 requested a review from accessibility-bot May 22, 2023 16:36
@accessibility-bot
Copy link
Collaborator

👋 Hello and thanks for pinging us! You've entered our first responder queue. An accessibility first responder will review this soon.

  • 💻 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.
  • ⚠️ If this is urgent, please visit us in #accessibility on Slack and tag the first responder(s) listed in the channel topic.

Copy link
Collaborator

@kendallgassner kendallgassner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When this is merged I can update the repo description!

@kendallgassner
Copy link
Collaborator

@khiga8 We may want to update the readme description too:

This action supports accessible content sharing on GitHub by leaving an automated reminder whenever an image is shared on a GitHub Issue or Pull request without meaningful alternative text (alt text). Alternative text helps convey the context of the image to those who use assistive technologies such as a screen reader and removes accessibility barriers.

GitHub Issue, Discussion or Pull request without

@@ -1,6 +1,6 @@
# Accessibility-alt-text-bot

This action supports accessible content sharing on GitHub by leaving an automated reminder whenever an image is shared on a GitHub Issue or Pull request without meaningful alternative text (alt text).
This action supports accessible content sharing on GitHub by leaving an automated reminder whenever an image is shared on a GitHub Issue, Pull request, or Discussion without meaningful alternative text (alt text).
Copy link
Collaborator

@kendallgassner kendallgassner May 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@khiga8 khiga8 merged commit 0a70e40 into main May 22, 2023
@khiga8 khiga8 deleted the kh-add-discussion-support branch May 23, 2023 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants