Setup-Badge
😎 Why you need setup-badge?
Setup-Badge creates dynamic and static endpoint badges to showcase on your README file. These badges can highlight key aspects such as build status, code coverage percentage, software version, license and more.
Note
- dynamic badge changes over time (e.g. code coverage percentage and software version)
- static badge doesn't change over time (e.g. license and programming language)
⭐ How setup-badge works
Under the hood, setup-badge creates a shields.io endpoint badge, which is composed of a shields.io endpoint and an URL to your JSON file (JSON Endpoint).

setup-badge workflow is outlined below.
- setup-badge runs with command line options.
- setup-badge adds/updates a json file from your options.
- setup-badge pushes a commit to the remote branch.
- endpoint badge is created with
shields.io endpointandyour json file.
Afterwards, you can put endpoint badge into your README file.
🎉 Use Case 1️⃣ - running on GitHub action
Summary: create multiple static badges
setup-badge-action:
- runs
on demand - creates two static badges:
languageandlicense- language badge does not have a badge url
- license badge has a badge url that links to the project's LICENSE file
Example: create multiple static badges
name: setup-badge-action
on:
workflow_dispatch:
permissions:
contents: read
jobs:
language-badge:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- id: language-badge
uses: tagdots/setup-badge-action@663d7a5382b8300caa4492de16e85aa7e4667ef0 # 1.0.3
with:
badge-name: language
label: Language
message: Python
message-color: FFA500
license-badge:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- id: license-badge
uses: tagdots/setup-badge-action@663d7a5382b8300caa4492de16e85aa7e4667ef0 # 1.0.3
with:
badge-name: license
badge-url: https://raw.githubusercontent.com/tagdots/setup-badge/refs/heads/main/LICENSE
label: License
message: MIT
message-color: FFA500
Summary: create a dynamic badge
setup-badge-action:
- runs
on schedule at 5:30 pm UTCoron demand - runs a coverage test and get the coverage percentage from the test result
- creates a dynamic
Code Coveragebadge with the coverage % that changes over time
Example: create a dynamic badge
name: setup-badge-action
on:
schedule:
- cron: '30 17 * * *'
workflow_dispatch:
permissions:
contents: read
jobs:
coverage-badge:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
COV_PER: ${{ steps.get-coverage-results.outputs.COV_PER }}
steps:
- id: coverage-run
run: coverage run
- id: get-coverage-results
run: |
echo "COV_PER=$(...coverage run results...)" >> "$GITHUB_OUTPUT"
- id: coverage-badge
uses: tagdots/setup-badge-action@663d7a5382b8300caa4492de16e85aa7e4667ef0 # 1.0.3
with:
badge-name: coverage
label: "Code Coverage"
message: "${{ steps.get-coverage-results.outputs.COV_PER }}"
🎉 Use Case 2️⃣ - running CLI locally
In this use case, you run setup-badge manually with the steps below:
- install setup-badge.
- run setup-badge.
🔆 install setup-badge
In the example below, we first install setup-badge in a Python virtual environment.
~/work/setup-badge $ workon setup-badge
(setup-badge) ~/work/setup-badge $ pip install -U setup-badge
🔧 run setup-badge command line options
| Input | Description | Default | Notes |
|---|---|---|---|
badge-name |
JSON endpoint filename | badge |
JSON endpoint filename |
branch-name |
Branch to hold JSON endpoint | badges |
a single branch can hold multiple JSON endpoint files |
badge-style |
Badge style | flat |
other options: flat-square, plastic, for-the-badge, social |
badge-url |
Badge URL | '' |
no default value (enter a url if necessary) |
label |
Left side text | demo |
- |
label-color |
Left side background color | 2e2e2e |
hex color |
message |
Right side text | no status |
place dynamic/static data here |
message-color |
Right side background color | 2986CC |
hex color |
remote-name |
Git remote source branch | origin |
leave it as-is in general |
gitconfig-name |
Git config user name | Mona Lisa |
need this option for CI or GitHub action |
gitconfig-email |
Git config user email | mona.lisa@github.com |
need this option for CI or GitHub action |
🏃 Run to create a license badge: --badge-name license --label License --message MIT --message-color FFA500 --badge-url https://raw.githubusercontent.com/tagdots/setup-badge/refs/heads/main/LICENSE
(setup-badge) ~/work/setup-badge $ setup-badge --badge-name license --label License --message MIT --message-color FFA500 --badge-url https://raw.githubusercontent.com/tagdots/setup-badge/refs/heads/main/LICENSE
🚀 Starting to create a badge (license.json) in branch (badges)...
✅ validated inputs from command line options
✅ checkout local branch (badges)
✅ created badges/license.json
✅ found changes ready to stage, commit, and push to origin
✅ pushed commit (dd8906c) to remote branch (badges)
🎉 Endpoint Badge: [](https://raw.githubusercontent.com/tagdots/setup-badge/refs/heads/main/LICENSE)
🏃 Run to create a marketplace badge: --badge-name marketplace --label Marketplace --message setup-badge-action --message-color FF6360 --badge-url https://github.com/marketplace/actions/setup-badge-action
(setup-badge) ~/work/setup-badge $ setup-badge --badge-name marketplace --label Marketplace --message setup-badge-action --message-color FF6360 --badge-url https://github.com/marketplace/actions/setup-badge-action
🚀 Starting to create a badge (marketplace.json) in branch (badges)...
✅ validated inputs from command line options
✅ checkout local branch (badges)
✅ created badges/marketplace.json
✅ found changes ready to stage, commit, and push to origin
✅ pushed commit (8991c28) to remote branch (badges)
🎉 Endpoint Badge: [](https://github.com/marketplace/actions/setup-badge-action)
✨ Summary of running the above commands
- badges branch can hold multiple JSON files.
- badges folder can hold json files from different branches.
🔔 What is next after creating the endpoint badge?
- copy
endpoint badgeoutput and paste to your README file - write a commit and merge your code
😕 Troubleshooting
Open an issue
🙏 Contributing
For pull requests to be accepted on this project, you should follow PEP8 when creating/updating Python codes.
See Contributing
🙌 Appreciation
If you find this project helpful, please ⭐ star it. Thank you.
📚 References
Metadata
Release files for setup-badge 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| setup_badge-1.2.1.tar.gz | 352.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| setup_badge-1.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 363.3 kB
Release files / setup_badge-1.2.1.tar.gz
| Download URL | setup_badge-1.2.1.tar.gz |
|---|---|
| Size | 352.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a99f9d0621b73af56d00facd406a984b5e68250d754666324ef089d49f7add4
|
|
BLAKE2b-256 checksum How to use checksums |
dba6940cfbb9cb1cd48cad1ee28ad71563c70149d6bcfc474a2c077d0819e0e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / setup_badge-1.2.1-py3-none-any.whl
| Download URL | setup_badge-1.2.1-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e0ac224b75b1c11d40e6377eee7f3ba6d711ad473fd60b606ed14de3eaa1023
|
|
BLAKE2b-256 checksum How to use checksums |
067837bc362d19e1e8799cae4404ebc1d36d73566b3c9853e11bdff415a1150c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|