Skip to content

Commit 9571c27

Browse files
author
Ben Wilhelm
committed
Use abbrev instead of long for option name
is an existing option for git describe, and it would be confusing to use it here for a different option
1 parent c7d65b3 commit 9571c27

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ inputs:
1717
description: 'Skip the unshallow operation: "true" or "false"'
1818
required: false
1919
default: "false"
20-
long:
21-
description: "Return long format tag: <tagName>-<revisionsSinceTag>-<currentCommit>"
20+
abbrev:
21+
description: "value to pass to the --abbrev flag. false to disable, default 0"
2222
required: false
23-
default: "false"
23+
default: 0
2424

2525
outputs:
2626
tag:

main.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ try {
1818
const include = getInput("include");
1919
const exclude = getInput("exclude");
2020
const commitIsh = getInput("commit-ish");
21-
const long = getInput("long") === "true";
21+
const abbrev = getInput("abbrev");
2222
const skipUnshallow = getInput("skip-unshallow") === "true";
2323

2424
var includeOption = "";
2525
var excludeOption = "";
2626
var commitIshOption = "";
27-
var abbrevOption = long ? "" : "--abbrev=0";
27+
var abbrevOption = "";
2828

2929
if (typeof include === "string" && include.length > 0) {
3030
includeOption = `--match '${include}'`;
@@ -43,6 +43,10 @@ try {
4343
commitIshOption = `'${commitIsh}'`;
4444
}
4545

46+
if (abbrev !== false) {
47+
abbrevOption = `--abbrev=${abbrev}`;
48+
}
49+
4650
var unshallowCmd = skipUnshallow ? "" : "git fetch --prune --unshallow &&";
4751

4852
// actions@checkout performs a shallow checkout. Need to unshallow for full tags access.

0 commit comments

Comments
 (0)