Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: npm
- run: npm ci
- run: npm run test
- run: npm run lint
- run: npm run check
- run: npm test
- run: npm run build
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ __tests__/runner/*

# comment out in distribution branches
node_modules/
lib/

# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
Expand Down
16 changes: 16 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Pin this repository to the public npm registry regardless of what the
# current user's `~/.npmrc` points at. This matters because:
#
# * This project is an open-source GitHub Action; external contributors
# (and GitHub-hosted runners) must be able to `npm install` without
# access to any private mirror.
# * `package-lock.json` records one `resolved` URL per package. If any
# contributor has a private mirror configured as their default
# registry and regenerates the lockfile, those private URLs get
# committed and break CI everywhere that cannot reach that mirror
# (e.g. `getaddrinfo ENOTFOUND artifactory.<org>.dev` on
# `ubuntu-latest`).
#
# Keep this file at the repo root; `npm` reads it in addition to `~/.npmrc`
# and the project-level setting wins for `registry`.
registry=https://registry.npmjs.org/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24
18 changes: 10 additions & 8 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/.github/
/.vscode/
/lib/
/docs/
/*.json
/*.js
/*.yml
/*.md
.github/
.vscode/
lib/
node_modules/
docs/
*.md
LICENSE
.nvmrc
.prettierignore
package-lock.json
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"singleQuote": true,
"parser": "typescript"
"trailingComma": "es5"
}
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

A GitHub Action to automatically bump and tag master, on merge, with the latest SemVer formatted version. Works on any platform.

## Requirements

This action runs on the **Node.js 24** Actions runtime (`runs.using: node24`
in [`action.yml`](./action.yml)). GitHub-hosted runners have shipped with
Node 24 since late 2025; self-hosted runners must be on runner version
`v2.328.0` or newer. The action is built as native ESM — the compiled
`lib/main.js` entrypoint is an ES module, matching the package's
`"type": "module"` declaration — so every dependency in the
(`@actions/*`, `@octokit/*`, `@semantic-release/*`,
`conventional-changelog-conventionalcommits`) graph loads cleanly with
Node 24's native ESM loader. No additional setup is needed in consumer
workflows — GitHub executes the bundled `lib/main.js` entrypoint directly.

### Developing locally

- Install: `npm ci` (public `registry.npmjs.org` only; see `.npmrc`).
- Test: `npm test` (runs [Vitest](https://vitest.dev) against the TS source).
- Watch tests: `npm run test:watch`.
- Lint: `npm run lint` (ESLint 9 flat config + typescript-eslint strict + stylistic).
- Format: `npm run format` / `npm run check`.
- Build: `npm run build` (emits native-ESM `lib/*.js` via `tsc`).

## Usage

```yaml
Expand All @@ -14,7 +36,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
Expand Down
64 changes: 32 additions & 32 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
name: "GitHub Tag"
description: "Bump and push git tag on merge"
author: "Mathieu Dutour"
name: 'GitHub Tag'
description: 'Bump and push git tag on merge'
author: 'Mathieu Dutour'
outputs:
new_tag:
description: "Generated tag"
description: 'Generated tag'
new_version:
description: "Generated tag without the prefix"
description: 'Generated tag without the prefix'
previous_tag:
description: "Previous tag (or `0.0.0`)"
description: 'Previous tag (or `0.0.0`)'
release_type:
description: "The computed release type (`major`, `minor`, `patch` or `custom` - can be prefixed with `pre`)"
description: 'The computed release type (`major`, `minor`, `patch` or `custom` - can be prefixed with `pre`)'
changelog:
description: "The conventional changelog since the previous tag"
description: 'The conventional changelog since the previous tag'
inputs:
github_token:
description: "Required for permission to tag the repo."
description: 'Required for permission to tag the repo.'
required: true
default_bump:
description: "Which type of bump to use when none explicitly provided when commiting to a release branch (default: `patch`)."
description: 'Which type of bump to use when none explicitly provided when commiting to a release branch (default: `patch`).'
required: false
default: "patch"
default: 'patch'
default_prerelease_bump:
description: "Which type of bump to use when none explicitly provided when commiting to a prerelease branch (default: `prerelease`)."
description: 'Which type of bump to use when none explicitly provided when commiting to a prerelease branch (default: `prerelease`).'
Comment on lines +20 to +24
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in input descriptions: "commiting" should be "committing" (appears in both the release-branch and prerelease-branch descriptions).

Copilot uses AI. Check for mistakes.
required: false
default: "prerelease"
default: 'prerelease'
tag_prefix:
description: "A prefix to the tag name (default: `v`)."
description: 'A prefix to the tag name (default: `v`).'
required: false
default: "v"
default: 'v'
append_to_pre_release_tag:
description: "A suffix to a pre-release tag name (default: `<branch>`)."
description: 'A suffix to a pre-release tag name (default: `<branch>`).'
required: false
custom_tag:
description: "Custom tag name. If specified, it overrides bump settings."
description: 'Custom tag name. If specified, it overrides bump settings.'
required: false
custom_release_rules:
description: "Comma separated list of release rules. Format: `<keyword>:<release_type>`. Example: `hotfix:patch,pre-feat:preminor`."
description: 'Comma separated list of release rules. Format: `<keyword>:<release_type>`. Example: `hotfix:patch,pre-feat:preminor`.'
required: false
release_branches:
description: "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`..."
description: '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`...'
required: false
default: "master,main"
default: 'master,main'
pre_release_branches:
description: "Comma separated list of branches (bash reg exp accepted) that will generate pre-release tags."
description: 'Comma separated list of branches (bash reg exp accepted) that will generate pre-release tags.'
required: false
commit_sha:
description: "The commit SHA value to add the tag. If specified, it uses this value instead GITHUB_SHA. It could be useful when a previous step merged a branch into github.ref."
description: 'The commit SHA value to add the tag. If specified, it uses this value instead GITHUB_SHA. It could be useful when a previous step merged a branch into github.ref.'
required: false
create_annotated_tag:
description: "Boolean to create an annotated tag rather than lightweight."
description: 'Boolean to create an annotated tag rather than lightweight.'
required: false
default: "false"
default: 'false'
fetch_all_tags:
description: "Boolean to fetch all tags for a repo (if false, only the last 100 will be fetched)."
description: 'Boolean to fetch all tags for a repo (if false, only the last 100 will be fetched).'
required: false
default: "false"
default: 'false'
dry_run:
description: "Do not perform tagging, just calculate next version and changelog, then exit."
description: 'Do not perform tagging, just calculate next version and changelog, then exit.'
required: false
default: "false"
default: 'false'

runs:
using: "node16"
main: "lib/main.js"
using: 'node24'
main: 'lib/main.js'
branding:
icon: "git-merge"
color: "purple"
icon: 'git-merge'
color: 'purple'
81 changes: 81 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// @ts-check
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import globals from 'globals';

export default tseslint.config(
{
ignores: ['lib/**', 'node_modules/**', 'coverage/**', '*.config.js'],
},
js.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
parserOptions: {
project: './tsconfig.eslint.json',
tsconfigRootDir: import.meta.dirname,
},
globals: {
...globals.node,
},
},
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports', fixStyle: 'inline-type-imports' },
],
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/restrict-template-expressions': [
'error',
{
allowNumber: true,
allowBoolean: true,
allowNullish: true,
},
],
'no-console': ['warn', { allow: ['info', 'warn', 'error'] }],
eqeqeq: ['error', 'always', { null: 'ignore' }],
},
},
{
files: ['tests/**/*.ts'],
rules: {
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/no-empty-function': 'off',
// Keep `no-unused-vars` active in tests too so dead assertions and
// typos are still caught; use the same `^_` escape hatch as production
// for intentionally-unused params (e.g. indices in fixture builders).
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/no-confusing-void-expression': 'off',
},
},
{
files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
...tseslint.configs.disableTypeChecked,
}
);
11 changes: 0 additions & 11 deletions jest.config.js

This file was deleted.

Loading