GitHub Action
Accessibility alt text bot
This action reminds users to add a meaningful alternative text to their images. Alternative text helps users who rely on tools like screen readers, and lowers accessibility barriers.
The action can check:
- 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.
Images on GitHub default to using the filename as alt text. This action flags when the alt text has not been updated from the default:
![Screenshot of an automated actions comment on a GitHub issue that says, 'Uh oh! @monalisa, the image you shared is missing helpful alt text...' and contains instructions for setting alt text](https://private-user-images.githubusercontent.com/16447748/239574762-c61cc9c6-f8c8-4bfb-becb-a155c2c9711d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU2NjM4NTMsIm5iZiI6MTcyNTY2MzU1MywicGF0aCI6Ii8xNjQ0Nzc0OC8yMzk1NzQ3NjItYzYxY2M5YzYtZjhjOC00YmZiLWJlY2ItYTE1NWMyYzk3MTFkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA2VDIyNTkxM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRiNDZhZTQzNTFiNjNhMTFkMTc0MGZhNDNiNTlkZTY1NDk2NWZmOWRiNGMzMDcyNjAxNTRmNzVjMWMzZjU3MWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.7pjZn1EhLvRFCskbYm6ORl8KKa8c0v9adyMOT2OUp3E)
Tip
Normally, setting alt=""
marks images as decorative. But GitHub renders all images as a link. To avoid rendering links with no names, we recommend always setting alt text on images in GitHub.
Copy this workflow into any repo you want the accessibility-alt-text-bot
to run in:
name: Accessibility-alt-text-bot
on:
issues:
types: [opened, edited]
pull_request:
types: [opened, edited]
issue_comment:
types: [created, edited]
discussion:
types: [created, edited]
discussion_comment:
types: [created, edited]
permissions:
issues: write
pull-requests: write
discussions: write
jobs:
accessibility_alt_text_bot:
name: Check alt text is set on issue or pull requests
runs-on: ubuntu-latest
steps:
- name: Get action 'github/accessibility-alt-text-bot'
uses: github/[email protected] # Set to latest
We recommend you pin the action to a specific version. This makes sure you stay on a stable version of this action.
uses: github/[email protected]
Replace the ref value with any commit hash.
This project is licensed under the terms of the MIT open source license. Please read the MIT license file for the full terms.
See CODEOWNERS.
TODO: Be explicit about support expectations.
Please read our Contributing Guide for more information.
Thanks goes to these wonderful people (emoji key):
Katie Foster 🤔 ️️️️♿️ |
Kendall Gassner 💻 ️️️️♿️ 📖 🚇 |
Kate Higa 💻 ️️️️♿️ 📖 🚇 |
HonkingGoose 📖 |
JoshuaKGoldberg 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!