Create tags with validation.
- Validates tag format using customizable regex
- Supports annotated and lightweight tags
- Can overwrite existing tags with
force: true - Creates tags from any branch
- Optional custom tag message
- Outputs tag SHA, existence flag, and URL
- Verifies the tag on the remote after push (with retries)
Your workflow must:
- Run on a runner with Git installed (default
ubuntu-latestmeets this) - Provide a token with
contents: writepermission to push tags
permissions:
contents: writename: Create Release Tag
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to create (e.g., v1.2.3)'
required: true
jobs:
tag:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Create Git Tag
uses: Mad-Pixels/github-workflows/actions/tag-creator@v1
with:
tag: ${{ github.event.inputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}
message: "Release ${{ github.event.inputs.tag }}"| Name | Required | Description | Default |
|---|---|---|---|
tag |
β Yes | Tag to create (e.g., v1.2.3) | - |
token |
β Yes | GitHub token or PAT with contents: write permissions |
- |
force |
β No | Overwrite existing tag if it exists (true/false) |
false |
branch |
β No | Branch to tag from | main |
tag_format |
β No | Regex to validate tag format | ^v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ |
message |
β No | Message for annotated tag (ignored for lightweight tags) | - |
lightweight |
β No | Create lightweight tag (overrides message) (true/false) |
false |
show_summary |
β No | Print summary with task output in job summary | true |
summary_limit |
β No | Max number of output lines to show in summary | 250 |
| Name | Description |
|---|---|
tag_sha |
SHA of the commit the tag points to |
tag_exists |
Whether the tag already existed before creation |
tag_url |
GitHub URL to view the created tag |
lightweight β create/replace tag β custom regex β non-default branch β with message β