Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nicjohnson145/tagbot
Automatically created tags based on conventional commits
https://github.com/nicjohnson145/tagbot
cicd continuous-integration github-actions go golang semantic-version
Last synced: about 2 months ago
JSON representation
Automatically created tags based on conventional commits
- Host: GitHub
- URL: https://github.com/nicjohnson145/tagbot
- Owner: nicjohnson145
- License: mit
- Created: 2022-09-02T17:51:52.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-01T00:15:18.000Z (almost 2 years ago)
- Last Synced: 2024-12-01T12:18:35.385Z (about 2 months ago)
- Topics: cicd, continuous-integration, github-actions, go, golang, semantic-version
- Language: Go
- Homepage:
- Size: 89.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tagbot
Automatically created tags based on conventional commits# Using manually
Download the relevant binary from [here](https://github.com/nicjohnson145/tagbot/releases/latest)
and place it in your `$PATH`. If you've cloned the repo via ssh, then just run `tagbot` from within
the repo you wish to create tags for. If you've cloned the repo via https then you'll need to export
`AUTH_TOKEN` as an access token with the ability to create tags.# Using as a Github Action
TagBot can be ran locally, or through Github Actions. Below is an example setup to only create tags
when pushing to the default branch```yaml
on:
push:
branches:
- main
tags-ignore:
- '**'jobs:
build-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: TagBot
uses: nicjohnson145/tagbot@latest
id: tagbot
env:
AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
### Note about triggering other workflowsThe default `${{ secrets.GITHUB_TOKEN }}` [can't create additional workflows](https://github.com/orgs/community/discussions/27028#discussioncomment-3254360).
If you want to use tagbot to create new tags when code is pushed to main, and goreleaser to create
releases when a new tag is created (the whole reason I wrote tagbot :)) then you'll need to replace
the token with a users access token.# Using commit-msg git hooks
Tagbot has commit-msg git hook functionality as well. To use this functionality place the following
script in your `.git/hooks` directory named `commit-msg` after downloading tagbot and adding it to
your `$PATH````sh
#! /usr/bin/env bashtagbot commit-msg $1
```### Global git hooks & disabling
Setting `core.hooksPath` in your global gitconfig can allow you to run tagbot for every repo you
clone. This greatly cuts down on repeated setup, as well as lowers the chance that the hook will be
forgotten on a new clone. However, not *every* repo needs to conform to tagbot. Tagbot can be
disabled for an individual repo by running```sh
git config --add tagbot.disable true
```in any repo that you wish tagbots `commit-msg` hook not to run
# Running on pull requests
Tagbot can retroactively validate commit messages on pull requests (if not everyone uses the
commit-msg hook). This can be accomplished with the following github action
```yaml
on:
pull_requestjobs:
check-commits:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: TagBot
uses: nicjohnson145/tagbot@latest
args:
- pull-request```
# OptionsTagbot supports a number of options, either on the command line or through environment variables
| Command Line | Environment | Use |
| ------------ | ----------- | --- |
| `--debug` | `DEBUG` | Enable debug logging |
| `--latest` | `LATEST` | Maintain a `latest` tag in addition to the SemVer tags |
| `--always-patch` | `ALWAYS_PATCH` | If the run were to result in no tag being created, instead create a tag with a patch version bump|
| `--remote-name` | `REMOTE_NAME` | Name of the remote to push tags to, defaults to `origin` |
| `--auth-method` | `AUTH_METHOD` | What method to use to auth, defaults to clone method of remote |
| `--auth-token` | `AUTH_TOKEN` | Token to use during HTTPS authentication |
| `--auth-token-username` | `AUTH_TOKEN_USERNAME` | Username to use during HTTPS authentication |
| `--auth-key-path` | `AUTH_KEY_PATH` | Path to key to use during SSH authentication |
| `--base-branch` | `BASE_BRANCH` | Base branch for merge request, will attempt to infer from well known CI systems variables |
| `--latest-name` | `LATEST_NAME` | Override the tag name when maintaining a latest tag |