{"id":13532721,"url":"https://github.com/anothrNick/github-tag-action","last_synced_at":"2025-04-01T21:30:52.079Z","repository":{"id":39380252,"uuid":"205024298","full_name":"anothrNick/github-tag-action","owner":"anothrNick","description":"A Github Action to tag a repo on merge.","archived":false,"fork":false,"pushed_at":"2024-09-23T11:44:13.000Z","size":208,"stargazers_count":775,"open_issues_count":19,"forks_count":381,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-10-30T06:32:22.049Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anothrNick.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-28T21:12:43.000Z","updated_at":"2024-10-29T19:12:36.000Z","dependencies_parsed_at":"2024-05-11T22:36:00.800Z","dependency_job_id":"872e4021-1252-4638-8be7-de95ab8abc3c","html_url":"https://github.com/anothrNick/github-tag-action","commit_stats":{"total_commits":239,"total_committers":55,"mean_commits":4.345454545454546,"dds":0.698744769874477,"last_synced_commit":"777684df761b882a3f4f70db16ac70d8cc78d0ea"},"previous_names":[],"tags_count":87,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anothrNick%2Fgithub-tag-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anothrNick%2Fgithub-tag-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anothrNick%2Fgithub-tag-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anothrNick%2Fgithub-tag-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anothrNick","download_url":"https://codeload.github.com/anothrNick/github-tag-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246712949,"owners_count":20821822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-08-01T07:01:13.199Z","updated_at":"2025-04-01T21:30:51.779Z","avatar_url":"https://github.com/anothrNick.png","language":"Shell","funding_links":[],"categories":["Community Resources","Shell"],"sub_categories":["Pull Requests"],"readme":"# github-tag-action\n\nA GitHub Action to automatically bump and tag master, on merge, with the latest SemVer formatted version.\n\n[![Build Status](https://github.com/anothrNick/github-tag-action/workflows/Bump%20version/badge.svg)](https://github.com/anothrNick/github-tag-action/workflows/Bump%20version/badge.svg)\n[![Stable Version](https://img.shields.io/github/v/tag/anothrNick/github-tag-action)](https://img.shields.io/github/v/tag/anothrNick/github-tag-action)\n[![Latest Release](https://img.shields.io/github/v/release/anothrNick/github-tag-action?color=%233D9970)](https://img.shields.io/github/v/release/anothrNick/github-tag-action?color=%233D9970)\n\n\u003e Medium Post: [Creating A GitHub Action to Tag Commits](https://itnext.io/creating-a-github-action-to-tag-commits-2722f1560dec)\n\n[\u003cimg src=\"https://miro.medium.com/max/1200/1*_4Ex1uUhL93a3bHyC-TgPg.png\" width=\"400\"\u003e](https://itnext.io/creating-a-github-action-to-tag-commits-2722f1560dec)\n\n\u003e 📣 [This project is seeking maintainers!](https://github.com/anothrNick/github-tag-action/issues/238) 📣\n\n## Usage\n\n_Note: We don't recommend using the @master version unless you're happy to test the latest changes._\n\n```yaml\n# example 1: on push to master\nname: Bump version\non:\n  push:\n    branches:\n      - master\n\njobs:\n  build:\n    runs-on: ubuntu-22.04\n    permissions:\n      contents: write\n    steps:\n    - uses: actions/checkout@v4\n      with:\n        fetch-depth: '0'\n\n    - name: Bump version and push tag\n      uses: anothrNick/github-tag-action@v1 # Don't use @master or @v1 unless you're happy to test the latest version\n      env:\n        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # if you don't want to set write permissions use a PAT token\n        WITH_V: false\n```\n\n```yaml\n# example 2: on merge to master from pull request (recommended)\nname: Bump version\non:\n  pull_request:\n    types:\n      - closed\n    branches:\n      - master\n\njobs:\n  build:\n    if: github.event.pull_request.merged == true\n    runs-on: ubuntu-22.04\n    permissions:\n      contents: write\n    steps:\n    - uses: actions/checkout@v4\n      with:\n        ref: ${{ github.event.pull_request.merge_commit_sha }}\n        fetch-depth: '0'\n\n    - name: Bump version and push tag\n      uses: anothrNick/github-tag-action@v1 # Don't use @master or @v1 unless you're happy to test the latest version\n      env:\n        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # if you don't want to set write permissions use a PAT token\n        WITH_V: true\n        PRERELEASE: true\n\n```\n\nDepending if you choose example 1 or example 2 is how crafted version bumps operate when reading the commit log.\n\nIs recommended to use on `pull_request` instead of on commit to master/main.\n\n_NOTE: set the fetch-depth for `actions/checkout@v2` or newer to be sure you retrieve all commits to look for the semver commit message._\n\n### Options\n\n**Environment Variables**\n\n- **GITHUB_TOKEN** **_(required)_** - Required for permission to tag the repo.\n- **DEFAULT_BUMP** _(optional)_ - Which type of bump to use when none explicitly provided (default: `minor`).\n- **DEFAULT_BRANCH** _(optional)_ - Overwrite the default branch its read from GitHub Runner env var but can be overwritten (default: `$GITHUB_BASE_REF`). Strongly recommended to set this var if using anything else than master or main as default branch otherwise in combination with history full will error.\n- **WITH_V** _(optional)_ - Tag version with `v` character.\n- **RELEASE_BRANCHES** _(optional)_ - Comma separated list of branches (bash reg exp accepted) that will generate the release tags. Other branches and pull-requests generate versions postfixed with the commit hash and do not generate any tag. Examples: `master` or `.*` or `release.*,hotfix.*,master` ...\n- **CUSTOM_TAG** _(optional)_ - Set a custom tag, useful when generating tag based on f.ex FROM image in a docker image. **Setting this tag will invalidate any other settings set!**\n- **SOURCE** _(optional)_ - Operate on a relative path under $GITHUB_WORKSPACE.\n- **DRY_RUN** _(optional)_ - Determine the next version without tagging the branch. The workflow can use the outputs `new_tag` and `tag` in subsequent steps. Possible values are `true` and `false` (default).\n- **GIT_API_TAGGING** _(optional)_ - Set if using git cli or git api calls for tag push operations. Possible values are `false` and `true` (default).\n- **INITIAL_VERSION** _(optional)_ - Set initial version before bump. Default `0.0.0`. MAKE SURE NOT TO USE vX.X.X here if combined WITH_V\n- **TAG_CONTEXT** _(optional)_ - Set the context of the previous tag. Possible values are `repo` (default) or `branch`.\n- **PRERELEASE** _(optional)_ - Define if workflow runs in prerelease mode, `false` by default. Note this will be overwritten if using complex suffix release branches. Use it with checkout `ref: ${{ github.sha }}` for consistency see [issue 266](https://github.com/anothrNick/github-tag-action/issues/266).\n- **PRERELEASE_SUFFIX** _(optional)_ - Suffix for your prerelease versions, `beta` by default. Note this will only be used if a prerelease branch.\n- **VERBOSE** _(optional)_ - Print git logs. For some projects these logs may be very large. Possible values are `true` (default) and `false`.\n- **MAJOR_STRING_TOKEN** _(optional)_ - Change the default `#major` commit message string tag.\n- **MINOR_STRING_TOKEN** _(optional)_ - Change the default `#minor` commit message string tag.\n- **PATCH_STRING_TOKEN** _(optional)_ - Change the default `#patch` commit message string tag.\n- **NONE_STRING_TOKEN** _(optional)_ - Change the default `#none` commit message string tag.\n- **BRANCH_HISTORY** _(optional)_ - Set the history of the branch for finding `#bumps`. Possible values `last`, `full` and `compare` defaults to `compare`.\n  - `full`: attempt to show all history, does not work on rebase and squash due missing HEAD [should be deprecated in v2 is breaking many workflows]\n  - `last`: show the single last commit\n  - `compare`: show all commits since previous repo tag number\n- **FORCE_WITHOUT_CHANGES** _(optional)_ - Enforce the brach creation even if there are no changes from the tag.\n- **FORCE_WITHOUT_CHANGES_PRE** _(optional)_ - Similar to force without changes, for pre-releases.\n\n### Outputs\n\n- **new_tag** - The value of the newly created tag.\n- **old_tag** - The value of the last semantic version tag before the version bump. Empty if no version bump is performed.\n- **tag** - The value of the latest tag after running this action.\n- **part** - The part of version which was bumped.\n\n\u003e **_Note:_** This action creates a [lightweight tag](https://developer.github.com/v3/git/refs/#create-a-reference).\n\n### Bumping\n\n**Manual Bumping:** Any commit message that includes `#major`, `#minor`, `#patch`, or `#none` will trigger the respective version bump. If two or more are present, the highest-ranking one will take precedence.\nIf `#none` is contained in the merge commit message, it will skip bumping regardless `DEFAULT_BUMP`.\n\n**Automatic Bumping:** If no `#major`, `#minor` or `#patch` tag is contained in the merge commit message, it will bump whichever `DEFAULT_BUMP` is set to (which is `minor` by default). Disable this by setting `DEFAULT_BUMP` to `none`.\n\n\u003e **_Note:_** This action **will not** bump the tag if the `HEAD` commit has already been tagged.\n\n### Workflow\n\n- Add this action to your repo\n- Commit some changes\n- Either push to master or open a PR\n- On push (or merge), the action will:\n  - Get latest tag\n  - Bump tag with minor version unless the merge commit message contains `#major` or `#patch`\n  - Pushes tag to GitHub\n  - If triggered on your repo's default branch (`master` or `main` if unchanged), the bump version will be a release tag. see [issue 266](https://github.com/anothrNick/github-tag-action/issues/266).\n  - If triggered on any other branch, a prerelease will be generated, depending on the bump, starting with `*-\u003cPRERELEASE_SUFFIX\u003e.1`, `*-\u003cPRERELEASE_SUFFIX\u003e.2`, ...\n  - To create a repository release you need another workflow like [automatic-releases](https://github.com/marketplace/actions/automatic-releases).\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) and [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).\n\n## Credits\n\n- [fsaintjacques/semver-tool](https://github.com/fsaintjacques/semver-tool)\n- [Contributors to this project](https://github.com/anothrNick/github-tag-action/graphs/contributors)\n\n## Projects using github-tag-action\n\nExamples of projects using github-tag-action for reference.\n\n- another/github-tag-action (uses itself to create tags)\n- [anothrNick/json-tree-service](https://github.com/anothrNick/json-tree-service)\n\n  \u003e Access JSON structure with HTTP path parameters as keys/indices to the JSON.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FanothrNick%2Fgithub-tag-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FanothrNick%2Fgithub-tag-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FanothrNick%2Fgithub-tag-action/lists"}