Ever wanted to add one of those badges that say “passing”, or even “failing” to your GitHub repositories README file? I recently created a project and had GitHub Actions run tests on the project so I could get an automatic notification if any changes broke my project.
One option I could have added was for the projects README file to show a badge, such as:
GitHub creates these badges to show if GitHub Actions are passing or failing. They are generated on a URL that follows the pattern:
https://github.com/<<GITHUB_AUTHOR>>/<<REPOSITORY_NAME>>/actions/workflows/<<WORKFLOW_FILE_NAME>>/badge.svg
For example, the above “Flask App Tests” badge is generated from:
https://github.com/geektechdude/qa-se-webapp/actions/workflows/github-actions.yml/badge.svg
Where my I’ve replaced GITHUB_AUTHOR, REPOSITORY_NAME and WORKFLOW_FILE_NAME with geektechdude, qa-se-webapp and github-actions.yml, where are my Github name, the repository name and the name of the file containing the YAML instructing GitHub Actions how to create and run tests called “Flask App Tests”.
The badge can be added to the README using markdown:
![example workflow](https://github.com/geektechdude/qa-se-webapp/actions/workflows/github-actions.yml/badge.svg)