Badgetizr is a tool that will add badges to your pull requests to increase your team's productivity. It is fully customizable and you can add (almost) as many badges as you want. With Badgtizr on your CI, you will be able to save time by:
- Stop adding a link to your ticket in the description of the PR if you add the id of it in the title of the PR.
- Reminding that some tasks are still missing to do in the PR.
- Stop adding a visual indicator if your PR is a WIP.
- Having a badge to know the status of the CI pipeline without having to click on it, scrolling down to the bottom of the page (coming soon).
📣 I would like to put this tool available with Homebrew and Apt-Get. To succeed, I need a maximum of star on this repository (according to the submission of Homebrew, min = 75stars). By using Homebrew or apt-get, I will be able to simplify the installation process by skipping the configure step below 🚀. Thank you for your help!
- Add option to use a custom configuration file
- Make the badge_ci badge dynamic (success, failure, pending)
- Add a beautiful icon for this repository
- Improve the Readme.md file
- Add the tools to Homebrew tap
- Add the tool to Homebrew
- Add the tool to Apt-Get
- Add the tools to Github Actions
- Support natively Gitlab with
glab
CLI
To see how to contribute, please refer to the section Contributing.
If your productivity has increased, my mission is done 🎉. This means I can go back to my coffee and enjoy it 🤤. If you want to support me, you can buy me a coffee, you will be mentioned in the README.md file as a backer ❤️. It will also motivate me to continue to work on this tool and improve it.
For now, only Github Pull Requests are supported. You have to export the environment variables GITHUB_TOKEN
such as:
export GITHUB_TOKEN="your_github_token"
Then you can run the configure script and the badgetizer script:
$ brew tap aiKrice/badgetizr
$ brew install aiKrice/badgetizr/badgetizr
# edit the .badgetizr.yml file to your needs
$ export GITHUB_TOKEN="your_github_token"
Coming soon...
$ git clone https://github.com/aiKrice/badgetizr.git --branch master
$ cd badgetizr
$ ./configure
In the rest of the documentation, I will consider that you have installed the tool in your $PATH
and remove the .sh
extension from the binary name.
$ badgetizr #[options]
To see the different options available, you can use the --help
option:
$ badgetizr --help
Instead of using the CLI, you can directly use the github action in your workflow.
jobs:
badgetizr:
runs-on: ubuntu-latest #works also on macos-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Run Badgetizr
uses: aiKrice/[email protected]
with:
pr_id: ${{ github.event.pull_request.number }}
configuration: .badgetizr.yml
pr_destination_branch: ${{ github.event.pull_request.base.ref }}
pr_build_number: ${{ github.run_id }}
pr_build_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
By default, the configuration file used is .badgetizr.yml
. You can also specify a configuration file to use by using the -c
option.
$ badgetizer -c my_config.yml
You can look to the .badgetizr.yml.example
file at the root of the repository to see the different configuration options available.
If you want to use an icon for your badge, you can use the icon
option and specify the icon name (badge ci only). All icons are available at simpleicons.org.
Disabled
by default.
The badge ticket is a badge that will be displayed on your pull request if you have a Jira ticket or a Youtrack ticket in your pull request title or overall, something you would like to extract from the pull request title.
To do so, you have to define a pattern that will be used to extract the data (ie: ticket id). This pattern will be used with the sed
command with the -n -E
options and the p
flag and will extract the first occurrence of the pattern found in the string. Badgetizr will process the pattern like this: sed -n -E "s/${ticket_badge_pattern}/\1/p"'
. You have to provide a regex group with ()
color
: The color of the badge (default:blue
).label
: The label of the badge (default:JIRA
).logo
: The logo of the badge (default:jirasoftware
).sed_pattern
: The pattern to use to extract the ticket id from the pull request title (default:.*\(([^)]+)\).*
, will match something likefeat(ABC-123): My Pull Request Title
->ABC-123
).url
: The url of the badge (default:https://yourproject.atlassian.net/browse/%s
, will behttps://yourproject.atlassian.net/browse/ABC-123
). You don't need to escape the-
and
Enabled
by default.
The badge wip is a badge that will be displayed on your pull request if the pull request title contains the word WIP
whatever the case.
Disabled
by default.
The badge dynamic is a badge that will be displayed on your pull request if the pull request body contains a pattern. You can define multiple patterns and each pattern will be displayed with a badge.
color
: The color of the badge (default:grey
).label
: The label of the badge (default:Task 2
).value
: The value of the badge (default:Done
).sed_pattern
: The pattern which will be applied against the pull request body (default:no pattern
). A regex group()
must be present or it will trigger a sed error. See .badgetizr.yml.example file.
example:
- sed_pattern: "(- [ ] Task 1)"
label: "Task 1"
value: "Not done"
color: "orange"
will display: if the checkbox is not checked.
In this case you can also use this to display a badge if the checkbox is checked. example:
- sed_pattern: "(- [x] Task 2)"
label: "Task 2"
value: "Done"
color: "green"
will display: if the checkbox is checked.
You don't need to escape the -
and
characters, they will be automatically escaped.
contains
). An opened issue has been created and you are welcome to contribute to fix this ❤️.
Enabled
by default.
The badge base branch is a badge that will be displayed on your pull request to indicate the target branch of the pull request. The default value is develop
.
--pr-destination-branch
: The base branch to use to compare the pull request to.
Disabled
by default.
The badge ci
is a badge that will be displayed on your pull request to indicate the status of the CI pipeline, the build number and the build url. Currently the status is static but it will be dynamic in a short future.
--pr-build-number
: The build number of the CI pipeline.--pr-build-url
: The build url of the CI pipeline.
color
: The color of the badge (default:purple
).label
: The label of the badge (default:Bitrise
).logo
: The logo of the badge (default:bitrise
).
badge_ticket:
enabled: "true"
settings:
color: "black"
label: "Github"
sed_pattern: '.*\[GH-([0-9]+)\].*'
url: "https://github.com/aiKrice/badgetizr/issues/%s"
logo: "github"
will match feat(scope): implement stuff [GH-1234] #will extract 1234
You are welcome to contribute to this project. The current rules to follow is that each time you are opening a pull request, you have to generate yourself the badge inside the pull request by running the script locally on your machine when your forked the repository.
example:
export GITHUB_TOKEN="your_github_token"
$ ./configure #optional, just for dependencies
$ ./badgetizer.sh
To publish the tool, you can run the publish.sh
script by providing the version you want to release. Please respect the semantic versioning notation.
./publish.sh 1.1.3
This script will bump everything possible to keep everything up-to-date.