Skip to content

Commit

Permalink
add a false option for default_bump
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieudutour committed May 27, 2020
1 parent f498350 commit 1ba75e9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ 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 }}
```
### 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`).
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
7 changes: 6 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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)}` : ""
}`;
Expand Down

0 comments on commit 1ba75e9

Please sign in to comment.