Date: Mon, 19 Jun 2023 09:58:07 -0700
Subject: [PATCH 7/9] Add all contributors (#21)
* Add @HonkingGoose as a contributor
* add_contributorg
---
.all-contributorsrc | 10 ++++++++++
README.md | 1 +
2 files changed, 11 insertions(+)
diff --git a/.all-contributorsrc b/.all-contributorsrc
index 12adb40..9f59a61 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -43,6 +43,16 @@
"doc",
"infra"
]
+ },
+ {
+ "login": "HonkingGoose",
+ "name": "HonkingGoose",
+ "avatar_url": "https://avatars.githubusercontent.com/u/34918129?v=4",
+ "profile": "https://github.com/HonkingGoose",
+ "contributions": [
+ "doc",
+ "a11y"
+ ]
}
],
"contributorsPerLine": 7,
diff --git a/README.md b/README.md
index cc84577..4f58ed4 100644
--- a/README.md
+++ b/README.md
@@ -95,6 +95,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
 Katie Foster 🤔 ️️️️♿️ |
 Kendall Gassner 💻 ️️️️♿️ 📖 🚇 |
 Kate Higa 💻 ️️️️♿️ 📖 🚇 |
+  HonkingGoose 📖 |
From 5d9b99c7628843cb0ce87e3f34cc5be995bc9b7b Mon Sep 17 00:00:00 2001
From: Kendall Gassner
Date: Mon, 26 Jun 2023 12:15:18 -0700
Subject: [PATCH 8/9] Update README to be more verbose about what the bot can
check (#25)
fixes #24
---
README.md | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 4f58ed4..29acb6e 100644
--- a/README.md
+++ b/README.md
@@ -5,9 +5,12 @@ Alternative text helps users who rely on tools like screen readers, and lowers a
The action can check:
-- Issues
-- Pull Requests
-- Discussions
+- Issue comments
+- Issue descriptions
+- Pull Request comments
+- Pull Request descriptions
+- Discussion comments
+- Discussion descriptions
To learn how to write good alternative text, read [Alternative text for images on Primer](https://primer.style/design/guides/accessibility/alternative-text-for-images).
From b5828a5ec03d5fc67860c0f656f4abca3947cced Mon Sep 17 00:00:00 2001
From: Kendall Gassner
Date: Wed, 5 Jul 2023 10:23:10 -0700
Subject: [PATCH 9/9] Flag images without alt text (#26)
* Flag images without alt text
* add exit on failure
* add todo;
* uncomment
* flag images without alt
---
action.yml | 4 +--
flag-alt-text.sh | 23 ++++++++-----
test-flag-alt-text.sh | 78 ++++++++++++++++++++++++-------------------
3 files changed, 60 insertions(+), 45 deletions(-)
diff --git a/action.yml b/action.yml
index e2c6757..5a54ece 100644
--- a/action.yml
+++ b/action.yml
@@ -59,8 +59,8 @@ runs:
Learn more about alt text at [Basic writing and formatting syntax: images on GitHub Docs](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#images)."
flag="$(flagAltText "$content")"
- echo $flag
- echo $type
+ echo "Detected bad alt text: ${flag}"
+ echo "Event type: $type"
if [[ $flag = true ]]; then
if [[ $type = pr_comment ]] || [[ $type = pr_description ]]; then
diff --git a/flag-alt-text.sh b/flag-alt-text.sh
index d9003fb..2eb16f4 100644
--- a/flag-alt-text.sh
+++ b/flag-alt-text.sh
@@ -1,13 +1,18 @@
#!/bin/bash
flagAltText() {
- markdownMacOsScreenshotRegex="^.*!\[(Clean|Screen) ?[S|s]hot [0-9][0-9][0-9][0-9]-[0-1][0-9]-[0-9][0-9].*\].*$"
- semanticMacOsScreenshotRegex="^.*'
- # html
- '
'
- '
'
- '
'
- '
'
- '
'
+ # markdown
+ '![Cleanshot 2020-01-01 at 12.00.00.png]'
+ '![Clean shot 2020-12-01 @12x]'
+ "![Clean shot 2020-12-01 @12x]"
+ "![Screen Shot 2020-01-01 at 12.00.00.png]"
+ "![Screenshot 2020-01-01 at 12.00.00.png]"
+ "![image]"
+ "![Image]"
+ "![]"
+ "Check this: ![Image]"
+ "My awesome ![image]"
+ 'Check this out:
'
+ # html
+ '
'
+ '
'
+ "
"
+ "
"
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
)
declare -a should_be_false=(
- # markdown
- "![Screenshot of the new GitHub home page]"
- "![Screen shot of Submit button with updated color contrast.]"
- "![Image of a cat]"
- # html
- '
'
- '
'
- '
'
+ # markdown
+ "![Screenshot of the new GitHub home page]"
+ "![Screen shot of Submit button with updated color contrast.]"
+ "![Image of a cat]"
+ # html
+ '
'
+ '
'
+ '
'
+ '
'
)
echo "******Expecting true:*******"
-for i in "${should_be_true[@]}"
-do
- echo "Testing: $i"
- assert_true "$(flagAltText "$i")" "$i must be true"
+for i in "${should_be_true[@]}"; do
+ echo "Testing: $i"
+ assert_true "$(flagAltText "$i")" "$i must be true"
+ if [ $? == 1 ]; then
+ exit 1
+ fi
done
echo "******Expecting false:*******"
-for i in "${should_be_false[@]}"
-do
- echo "Testing: $i"
- assert_false "$(flagAltText "$i")" "$i must be false"
+for i in "${should_be_false[@]}"; do
+ echo "Testing: $i"
+ assert_false "$(flagAltText "$i")" "$i must be false"
+ if [ $? == 1 ]; then
+ exit 1
+ fi
done
-