Add alt text check workflow#11268
Conversation
|
|
📝 WalkthroughChangesWorkflow Addition: Introduces a new GitHub Actions workflow that automatically checks pull requests for images in Markdown files lacking alt text. The workflow runs
If matches are found, the workflow outputs offending line locations and fails the PR check. The check applies to Markdown files under Documentation Updates: Minor corrections to two documentation files:
ImpactAdds automated accessibility and SEO validation to the PR review process by flagging images without alt text, helping raise contributor awareness of accessibility best practices. WalkthroughThis pull request introduces a new GitHub Actions workflow to validate image alt text in Markdown documentation files. The workflow detects empty alt text in Markdown image syntax ( 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/alt-text-check.yml:
- Line 18: The regex used to populate html_missing_alt (the git grep pattern
"<img\b(?![^>]*\balt=)[^>]*>") is too permissive and case-sensitive; update the
pattern used in html_missing_alt to use case-insensitive matching and require a
whitespace boundary around alt (e.g., prefix with (?i) and replace \balt= with
\salt\s*=) so it catches <IMG> and avoids matching attributes like data-alt=
while keeping the existing negative lookahead logic.
In `@en/docs/administer/role-based-access-control.md`:
- Line 24: Rewrite the sentence in step 4 to produce a single clear instruction:
replace the two clauses "And select the scopes..." and "For example, If..." with
one flowing sentence that instructs the user to choose "Custom scope
assignments" in the "Select Permissions" menu and then pick the desired scopes,
and include the example scopes `apim:keymanagers_manage`, `apim:tenantInfo`, and
`apim:admin_settings` as a concrete example; ensure "If" is lowercased and
remove the leading "And" so the sentence reads smoothly.
In
`@en/docs/install-and-setup/setup/distributed-deployment/configuring-apim-as-a-gateway.md`:
- Line 35: The phrase "with regards to trying out" in the sentence "You can
refer to the [Quick Start
Guide](https://apk.docs.wso2.com/en/latest/get-started/quick-start-guide-with-cp/)
with regards to trying out API Control Plane with Kubernetes Gateway using
APIM-APK Agent." is grammatically awkward; replace it with a correct and simpler
wording such as "for trying out" or "to try out" so the sentence reads e.g. "You
can refer to the Quick Start Guide for trying out API Control Plane with
Kubernetes Gateway using APIM-APK Agent." Ensure the linked text remains
unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 17199077-efa8-47e2-8bef-56ace17bb52a
📒 Files selected for processing (3)
.github/workflows/alt-text-check.ymlen/docs/administer/role-based-access-control.mden/docs/install-and-setup/setup/distributed-deployment/configuring-apim-as-a-gateway.md
| # Find markdown images with empty alt:  or  | ||
| md_empty_alt=$(git grep -n -E "!\[\s*\]\([^)]*\)" -- 'en/**/*.md' || true) | ||
| # Find HTML <img> tags missing an alt attribute | ||
| html_missing_alt=$(git grep -n -P "<img\b(?![^>]*\balt=)[^>]*>" -- 'en/**/*.md' || true) |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
cat >/tmp/alt_text_samples.md <<'EOF'
<img src="a.png">
<img data-alt="decorative" src="b.png">
<IMG SRC="c.png">
<img alt="ok" src="d.png">
EOF
echo "Current pattern:"
grep -nP "<img\b(?![^>]*\balt=)[^>]*>" /tmp/alt_text_samples.md || true
echo "Proposed pattern:"
grep -nP "(?i)<img\b(?![^>]*\salt\s*=)[^>]*>" /tmp/alt_text_samples.md || trueRepository: wso2/docs-apim
Length of output: 195
🏁 Script executed:
cat -n .github/workflows/alt-text-check.yml | head -30Repository: wso2/docs-apim
Length of output: 1148
🏁 Script executed:
# Verify the exact pattern on line 18
sed -n '18p' .github/workflows/alt-text-check.ymlRepository: wso2/docs-apim
Length of output: 157
🏁 Script executed:
# Test additional edge cases for the proposed pattern
cat >/tmp/alt_text_extended.md <<'EOF'
<img src="a.png">
<img data-alt="decorative" src="b.png">
<IMG SRC="c.png">
<img alt="ok" src="d.png">
<img ALT="ok" src="e.png">
<img alt = "ok" src="f.png">
<img alt="" src="g.png">
<img data-alt="test" alt="ok" src="h.png">
<img src="i.png" data-alt="">
EOF
echo "=== Testing proposed pattern with edge cases ==="
grep -nP "(?i)<img\b(?![^>]*\salt\s*=)[^>]*>" /tmp/alt_text_extended.md || trueRepository: wso2/docs-apim
Length of output: 221
Tighten <img> regex to avoid false negatives.
The current pattern on line 18 misses two cases: HTML <img> tags in uppercase (e.g., <IMG>) due to case-sensitive matching, and attributes like data-alt= are incorrectly accepted as valid alt= attributes due to word-boundary matching.
Proposed fix
- html_missing_alt=$(git grep -n -P "<img\b(?![^>]*\balt=)[^>]*>" -- 'en/**/*.md' || true)
+ html_missing_alt=$(git grep -n -P "(?i)<img\b(?![^>]*\salt\s*=)[^>]*>" -- 'en/**/*.md' || true)The updated pattern uses (?i) for case-insensitive matching and \salt\s*= to require whitespace boundaries around alt=, preventing matches against data-alt= or similar attributes.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| html_missing_alt=$(git grep -n -P "<img\b(?![^>]*\balt=)[^>]*>" -- 'en/**/*.md' || true) | |
| html_missing_alt=$(git grep -n -P "(?i)<img\b(?![^>]*\salt\s*=)[^>]*>" -- 'en/**/*.md' || true) |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/alt-text-check.yml at line 18, The regex used to populate
html_missing_alt (the git grep pattern "<img\b(?![^>]*\balt=)[^>]*>") is too
permissive and case-sensitive; update the pattern used in html_missing_alt to
use case-insensitive matching and require a whitespace boundary around alt
(e.g., prefix with (?i) and replace \balt= with \salt\s*=) so it catches <IMG>
and avoids matching attributes like data-alt= while keeping the existing
negative lookahead logic.
| 2. Click `Scope Assignments` in the left sidebar and click on `Add scope mappings` . | ||
| 3. In the `Provide role name` text input give the role name which was previously created in step 1 and then click `next`. | ||
| 4. In the `Select Permissions` menu, select the `Custom scope assignments` option. And select the scopes that you want to assign for the newly created role. You can refer the following table when assigning the scopes. For example, If the admin wants the newly created user to access the key managers settings in the admin portal he can assign `apim:keymanagers_manage`, `apim:tenantInfo`, and `apim:admin_settings`. | ||
| 4. In the `Select Permissions` menu, select the `Custom scope assignments` option. And select the scopes that you want to assign for the newly created role. You can refer to the following table when assigning the scopes. For example, If the admin wants the newly created user to access the key managers settings in the admin portal he can assign `apim:keymanagers_manage`, `apim:tenantInfo`, and `apim:admin_settings`. |
There was a problem hiding this comment.
Tighten wording for readability in this instruction step.
This sentence is grammatically awkward in two places ("And select...", "For example, If..."). Please rewrite it as one clear flow to improve documentation quality.
Suggested rewrite
-4. In the `Select Permissions` menu, select the `Custom scope assignments` option. And select the scopes that you want to assign for the newly created role. You can refer to the following table when assigning the scopes. For example, If the admin wants the newly created user to access the key managers settings in the admin portal he can assign `apim:keymanagers_manage`, `apim:tenantInfo`, and `apim:admin_settings`.
+4. In the `Select Permissions` menu, select `Custom scope assignments`, then choose the scopes to assign to the newly created role. Refer to the following table when assigning scopes. For example, if the admin wants the newly created user to access Key Manager settings in the Admin Portal, assign `apim:keymanagers_manage`, `apim:tenantInfo`, and `apim:admin_settings`.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 4. In the `Select Permissions` menu, select the `Custom scope assignments` option. And select the scopes that you want to assign for the newly created role. You can refer to the following table when assigning the scopes. For example, If the admin wants the newly created user to access the key managers settings in the admin portal he can assign `apim:keymanagers_manage`, `apim:tenantInfo`, and `apim:admin_settings`. | |
| 4. In the `Select Permissions` menu, select `Custom scope assignments`, then choose the scopes to assign to the newly created role. Refer to the following table when assigning scopes. For example, if the admin wants the newly created user to access Key Manager settings in the Admin Portal, assign `apim:keymanagers_manage`, `apim:tenantInfo`, and `apim:admin_settings`. |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@en/docs/administer/role-based-access-control.md` at line 24, Rewrite the
sentence in step 4 to produce a single clear instruction: replace the two
clauses "And select the scopes..." and "For example, If..." with one flowing
sentence that instructs the user to choose "Custom scope assignments" in the
"Select Permissions" menu and then pick the desired scopes, and include the
example scopes `apim:keymanagers_manage`, `apim:tenantInfo`, and
`apim:admin_settings` as a concrete example; ensure "If" is lowercased and
remove the leading "And" so the sentence reads smoothly.
| ## Next Steps | ||
|
|
||
| You can refer the [Quick Start Guide](https://apk.docs.wso2.com/en/latest/get-started/quick-start-guide-with-cp/) with regards to trying out API Control Plane with Kubernetes Gateway using APIM-APK Agent. | ||
| You can refer to the [Quick Start Guide](https://apk.docs.wso2.com/en/latest/get-started/quick-start-guide-with-cp/) with regards to trying out API Control Plane with Kubernetes Gateway using APIM-APK Agent. |
There was a problem hiding this comment.
Use “with regard to” (or simplify phrasing) for grammatical correctness.
with regards to trying out is awkward. Consider:
You can refer to the [Quick Start Guide](https://apk.docs.wso2.com/en/latest/get-started/quick-start-guide-with-cp/) for trying out API Control Plane with Kubernetes Gateway using APIM-APK Agent.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@en/docs/install-and-setup/setup/distributed-deployment/configuring-apim-as-a-gateway.md`
at line 35, The phrase "with regards to trying out" in the sentence "You can
refer to the [Quick Start
Guide](https://apk.docs.wso2.com/en/latest/get-started/quick-start-guide-with-cp/)
with regards to trying out API Control Plane with Kubernetes Gateway using
APIM-APK Agent." is grammatically awkward; replace it with a correct and simpler
wording such as "for trying out" or "to try out" so the sentence reads e.g. "You
can refer to the Quick Start Guide for trying out API Control Plane with
Kubernetes Gateway using APIM-APK Agent." Ensure the linked text remains
unchanged.
Purpose
Goals
Approach
User stories
Release note
Documentation
Training
Certification
Marketing
Automation tests
Type: CI workflow (GitHub Actions) — runs on pull_request.
Unit tests: N/A
Integration tests: N/A
Security checks
Secure coding guidelines followed: N/A (workflow is configuration-only)
FindSecurityBugs run: N/A
Secrets check: yes — this change commits no keys, passwords, tokens, or credentials.
Samples
Related PRs
Migrations (if applicable)
Test environment
Learning