Skip to content

Commit

Permalink
Added dry_run option
Browse files Browse the repository at this point in the history
  • Loading branch information
qvistgaard committed Mar 28, 2020
1 parent 8a2b37b commit dbe810a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- **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`).
- **dry_run** _(optional)_ - Do not perform taging, just calculate next version and changelog, then exit

### Outputs

Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ inputs:
description: "Boolean to create an annotated tag rather than lightweight"
required: false
default: false
dry_run:
description: "Do not perform taging, just calculate next version and changelog, then exit"
required: false
default: false

runs:
using: "node12"
main: "lib/main.js"
Expand Down
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.0.0",
"version": "4.1.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
6 changes: 6 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ async function run() {
const tagPrefix = core.getInput("tag_prefix");
const releaseBranches = core.getInput("release_branches");
const createAnnotatedTag = core.getInput("create_annotated_tag");
const dryRun = core.getInput("dry_run");

const { GITHUB_REF, GITHUB_SHA } = process.env;

Expand Down Expand Up @@ -146,6 +147,11 @@ async function run() {
return;
}

if (dryRun) {
core.info("Dry run: not performing tag action.");
return;
}

const octokit = new GitHub(core.getInput("github_token"));

if (createAnnotatedTag === "true") {
Expand Down

0 comments on commit dbe810a

Please sign in to comment.