diff --git a/README.md b/README.md index 11bcef430..33d63b1ba 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/checkout@master - name: Bump version and push tag - uses: mathieudutour/github-tag-action@v4.3 + uses: mathieudutour/github-tag-action@v4.4 with: github_token: ${{ secrets.GITHUB_TOKEN }} ``` @@ -24,7 +24,7 @@ jobs: ### Inputs - **github_token** _(required)_ - Required for permission to tag the repo. Usually `${{ secrets.GITHUB_TOKEN }}`. -- **default_bump** _(optional)_ - Which type of bump to use when [none explicitly provided](#bumping) (default: `patch`). +- **default_bump** _(optional)_ - Which type of bump to use when [none is explicitly provided](#bumping) (default: `patch`). You can also set `false` to avoid generating a new tag when none is explicitly provided. - **tag_prefix** _(optional)_ - A prefix to the tag name (default: `v`). - **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`... (default: `master`). - **create_annotated_tag** _(optional)_ - Boolean to create an annotated rather than a lightweight one (default: `false`). diff --git a/package-lock.json b/package-lock.json index 7a5e7d419..e975a0c60 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "github-tag-action", - "version": "4.2.0", + "version": "4.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4d599a7e0..415a9ed5a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "github-tag-action", - "version": "4.3.0", + "version": "4.4.0", "private": true, "description": "A Github Action to automatically bump and tag master, on merge, with the latest SemVer formatted version.", "main": "lib/main.js", diff --git a/src/main.ts b/src/main.ts index f514ebe6a..aca45086a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -42,7 +42,7 @@ async function exec(command: string) { async function run() { try { - const defaultBump = core.getInput("default_bump") as ReleaseType; + const defaultBump = core.getInput("default_bump") as ReleaseType | "false"; const tagPrefix = core.getInput("tag_prefix"); const releaseBranches = core.getInput("release_branches"); const createAnnotatedTag = core.getInput("create_annotated_tag"); @@ -110,6 +110,11 @@ async function run() { { commits, logger: { log: console.info.bind(console) } } ); + if (!bump && defaultBump === "false") { + core.debug("No commit specifies the version bump. Skipping..."); + return; + } + const newVersion = `${inc(tag, bump || defaultBump)}${ preRelease ? `-${GITHUB_SHA.slice(0, 7)}` : "" }`;