Skip to main content

No project description provided

Project description

setup-badge

OpenSSF Best Practices CI marketplace coverage


๐Ÿ˜Ž Why you need setup-badge?

Repository badges highlight your project's key aspects such as build status, code coverage percentage, software version, license and more.

setup-badge empowers you to create dynamic and static endpoint badges to showcase on your README file.

Note:
dynamic badge changes regularly over time (e.g. code coverage percentage and software version)
static badge doesn't change regularly 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).

![badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/tagdots/setup-badge/refs/heads/badges/badges/badge.json)

setup-badge workflow is outlined below.

  1. setup-badge runs with command line options.
  2. setup-badge adds/updates a json file from your options.
  3. setup-badge pushes a commit to the remote branch.
  4. endpoint badge is created with shields.io endpoint and your json file.

Afterwards, you can put endpoint badge into your README file.

How It Works


Use Case 1๏ธโƒฃ - running on GitHub action

In this use case, you run our setup-badge-action in a workflow to create badge(s).

Please visit our GitHub action (setup-badge-action) on the GitHub Marketplace for details.


Use Case 2๏ธโƒฃ - running locally on your computer

In this use case, you run setup-badge manually with the steps below:

  1. install setup-badge.
  2. run setup-badge.

๐Ÿ”† install setup-badge

In the example below, we first install setup-badge in a Python virtual environment.

~/work/badge-test $ workon badge-test
(badge-test) ~/work/badge-test $ pip install -U setup-badge

๐Ÿ” run setup-badge

Next, we run setup-badge with different options and display the results.


๐Ÿƒ Run to display command line options: --help

(badge-test) ~/work/badge-test $ setup-badge --help
Usage: setup-badge [OPTIONS]

Options:
  --badge-name TEXT       default: badge
  --badge-branch TEXT     default: badges
  --badge-url TEXT        default: ''
  --badge-style TEXT      default: flat (flat, flat-square, plastic, for-the-badge, social)
  --label TEXT            default: demo (badge left side text)
  --label-color TEXT      default: 2e2e2e (badge left side hex color)
  --message TEXT          default: no status (badge right side text)
  --message-color TEXT    default: 2986CC (badge right side hex color)
  --remote-name TEXT      default: origin
  --gitconfig-name TEXT   default: Mona Lisa
  --gitconfig-email TEXT  default: mona.lisa@github.com
  --version               Show the version and exit.
  --help                  Show this message and exit.



๐Ÿƒ Run to create a demo badge: with default command line options

(badge-test) ~/work/badge-test $ setup-badge

๐Ÿš€ Starting to create a badge.json in branch (badges)...

โœ… validated inputs from command line options
โœ… checkout local branch (badges)
โœ… created badges/badge.json
โœ… found changes ready to stage, commit, and push to origin
โœ… pushed commit (f9c751c) to remote branch (badges)

๐ŸŽ‰ Endpoint Badge: ![badge](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/tagdots/setup-badge/refs/heads/badges/badges/badge.json)

Endpoint Badge
demo



๐Ÿƒ 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

(badge-test) ~/work/badge-test $ 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: [![license](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/tagdots/setup-badge/refs/heads/badges/badges/license.json)](https://raw.githubusercontent.com/tagdots/setup-badge/refs/heads/main/LICENSE)

Endpoint Badge
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

(badge-test) ~/work/badge-test $ 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: [![marketplace](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/tagdots/setup-badge/refs/heads/badges/badges/marketplace.json)](https://github.com/marketplace/actions/setup-badge-action)

Endpoint Badge
marketplace



โœจ Summary of running the above commands

  • badges branch can hold multiple JSON files.
  • badges folder can hold json files from different branches.

Command Runs



๐Ÿ”” What is next after creating the endpoint badge?

  • copy and paste to your README file
  • write a commit and merge your code



๐Ÿ”ง 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

๐Ÿ˜• 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

Shields.io Endpoint Badge

Hex Color

How to fork a repo


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

setup_badge-1.0.11.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

setup_badge-1.0.11-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file setup_badge-1.0.11.tar.gz.

File metadata

  • Download URL: setup_badge-1.0.11.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for setup_badge-1.0.11.tar.gz
Algorithm Hash digest
SHA256 30ee9d5cdfd8f87caa97d524cdf784452fb107e81a8b80c51ba9bc7f51ffc6fe
MD5 ef2e9492dd203971b4fc0d4e751d4d87
BLAKE2b-256 4f74091f82ea29efa5c9d2c78f15783fe050a74049f3f5ec5442d40c4d6f28f2

See more details on using hashes here.

File details

Details for the file setup_badge-1.0.11-py3-none-any.whl.

File metadata

  • Download URL: setup_badge-1.0.11-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for setup_badge-1.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 eed850e65f1ea12b2e882f0295e577af5d66817eb8a7ffe8920f6c096ad0233f
MD5 e3cd3e191c18dbf8aae30d1943a7afce
BLAKE2b-256 4060c6f8820eaff648cf779f1eb8736043daea41119292fd53ce50d1df27699e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page