add "git_ref" output that contains either tag or branch name
This commit is contained in:
+4
-1
@@ -13,6 +13,7 @@ export function collect_git(debug = false, output = false) {
|
||||
git_ref_branch : false,
|
||||
git_is_default_branch: false,
|
||||
git_tag : false,
|
||||
git_ref : false,
|
||||
semver_valid : false,
|
||||
semver_major : false,
|
||||
semver_minor : false,
|
||||
@@ -54,13 +55,15 @@ export function collect_git(debug = false, output = false) {
|
||||
);
|
||||
}
|
||||
r.git_current_branch = github.context.ref.slice('refs/heads/'.length);
|
||||
r.git_ref = r.git_current_branch;
|
||||
r.git_ref_branch = r.git_current_branch; // same as current branch for non-PR, non-Tag
|
||||
r.git_is_default_branch = r.git_current_branch == r.git_default_branch;
|
||||
r.git_is_default_branch = r.git_current_branch === r.git_default_branch;
|
||||
}
|
||||
|
||||
// parse semver for tags
|
||||
if (r.git_is_tag) {
|
||||
r.git_tag = github.context.ref.slice('refs/tags/'.length);
|
||||
r.git_ref = r.git_tag;
|
||||
|
||||
const parsed = semverParser.parseSemVer(r.git_tag);
|
||||
if (debug) {
|
||||
|
||||
Reference in New Issue
Block a user