Skip to content

feat: Github workflow for a11y issues benchmarking #4

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

manojvenkatap
Copy link

This GitHub workflow fetches accessibility tickets based on defined SLAs. If a ticket breaches the SLA, labels are added to track and prioritize issues for easier resolution.

@manojvenkatap manojvenkatap requested a review from thuey March 12, 2025 12:58
@manojvenkatap manojvenkatap requested a review from a team as a code owner March 12, 2025 12:58
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
set -e
Copy link
Collaborator

Choose a reason for hiding this comment

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

You may want to define this code in a separate bash script (e.g. label_a11y_issues.sh) instead of inline. It would probably be easier to maintain that way

Copy link
Author

Choose a reason for hiding this comment

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

This one i am not sure how to do this? could you please help me

Copy link
Collaborator

Choose a reason for hiding this comment

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

What I'm suggesting is you:

  1. Create a file called label_a11y_issues.sh
  2. Make it executable (e.g. chmod +x label_a11y_issues.sh
  3. Move everything that's in the run block into the file and add a #!/bin/bash to the top of the file. Example:
#!/bin/bash

set -e
....
  1. Update this to just run the script: run: ./label_a11y_issues.sh

Comment on lines 27 to 34
# Define SLA Thresholds
declare -A LABEL_THRESHOLDS=( ["Blocker"]=4 ["Critical"]=10 ["Serious"]=20 ["Moderate"]=30 ) # Numbers in weeks

# Required labels for filtering
REQUIRED_LABELS=("A11y" "VPAT")

# Updated SLA Labels
SLA_LABELS=("SLA P1" "SLA P2" "SLA P3" "SLA Breach")
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't have to do this now, but maybe a future enhancement would be to make these values configurable via inputs

Copy link
Author

Choose a reason for hiding this comment

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

will do this later one after running some successful runs

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please add a README.md, describing how this action is to be used? Check out the other action in this repo for an example.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@manojvenkatap This comment still needs to be addressed

Copy link
Author

Choose a reason for hiding this comment

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

added readme.md, but i am not confident that the example provided will work or not because i have not tested. please suggest if any changes needed

Copy link
Collaborator

Choose a reason for hiding this comment

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

You should be able to test it by following the instructions you provided in a test repo. You'll just point at the latest commit hash in this branch instead of main

env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
set -e
Copy link
Collaborator

Choose a reason for hiding this comment

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

What I'm suggesting is you:

  1. Create a file called label_a11y_issues.sh
  2. Make it executable (e.g. chmod +x label_a11y_issues.sh
  3. Move everything that's in the run block into the file and add a #!/bin/bash to the top of the file. Example:
#!/bin/bash

set -e
....
  1. Update this to just run the script: run: ./label_a11y_issues.sh

Copy link
Collaborator

@thuey thuey left a comment

Choose a reason for hiding this comment

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

Mostly smaller things now

Copy link
Collaborator

Choose a reason for hiding this comment

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

@manojvenkatap This comment still needs to be addressed

# Determine impact level
IMPACT_LEVEL=""
for level in "${!LABEL_THRESHOLDS[@]}"; do
if [[ "$LABELS" == *"$level"* ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need/want the *? If we do any kind of loose checking, it seems like it should be to not be case sensitive. Something like:

Suggested change
if [[ "$LABELS" == *"$level"* ]]; then
if [[ "${LABELS,,}" == "${level,,}" ]]; then

Copy link
Author

Choose a reason for hiding this comment

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

Provided suggestion is matching if LABELS exactly equals Blocker, Critical, etc, But GitHub issues usually have multiple labels, and LABELS is like "A11y, VPAT, Serious", so LABELS != Serious exactly. so i changed to if echo "$LABELS" | grep -iq "$level"; then

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see, I misread this before. However, your example is still problematic if there is a label that contains one of these words (e.g. "very serious" or something).

A better approach would be to do something like this:

if echo "$issue" | jq -e '.labels[].name | ascii_downcase | select(. == (\"$level\" | ascii_downcase))' > /dev/null; then

This uses jq to find if the label is in the list of labels by checking each label, rather than doing a string search against a concatenated string, which is potentially error prone

REMOVE_LABELS=()

for sla_label in "${SLA_LABELS[@]}"; do
if [[ "$LABELS" == *"$sla_label"* ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above. Consider doing this:

Suggested change
if [[ "$LABELS" == *"$sla_label"* ]]; then
if [[ "${LABELS,,}" == "${sla_label,,}" ]]; then

Copy link
Collaborator

Choose a reason for hiding this comment

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

See updated suggestion

@thuey
Copy link
Collaborator

thuey commented Apr 2, 2025

@manojvenkatap manojvenkatap changed the title Create A11y SLA.yml (feat): Github workflow for a11y issues benchmarking Apr 4, 2025
@manojvenkatap manojvenkatap changed the title (feat): Github workflow for a11y issues benchmarking feat: Github workflow for a11y issues benchmarking Apr 4, 2025
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should be able to test it by following the instructions you provided in a test repo. You'll just point at the latest commit hash in this branch instead of main

# Determine impact level
IMPACT_LEVEL=""
for level in "${!LABEL_THRESHOLDS[@]}"; do
if [[ "$LABELS" == *"$level"* ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see, I misread this before. However, your example is still problematic if there is a label that contains one of these words (e.g. "very serious" or something).

A better approach would be to do something like this:

if echo "$issue" | jq -e '.labels[].name | ascii_downcase | select(. == (\"$level\" | ascii_downcase))' > /dev/null; then

This uses jq to find if the label is in the list of labels by checking each label, rather than doing a string search against a concatenated string, which is potentially error prone

REMOVE_LABELS=()

for sla_label in "${SLA_LABELS[@]}"; do
if [[ "$LABELS" == *"$sla_label"* ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

See updated suggestion

Copy link
Collaborator

@thuey thuey left a comment

Choose a reason for hiding this comment

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

I think this is good enough that we can start using it. But in a follow-up PR, can you please:

  1. Add unit tests for a11y-sla.sh
  2. Add shellcheck

I can help you get this set up if you want to schedule a pairing session

Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Since this file is only used in actions/a11y-sla-breach-labels, it would be best to collocate it there

Copy link
Author

Choose a reason for hiding this comment

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

can we do this in next PR?

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