add "git_ref" output that contains either tag or branch name
This commit is contained in:
parent
4c3315660d
commit
121814e013
@ -26,6 +26,8 @@ outputs:
|
|||||||
description: 'The branch that triggered the workflow run. e.g `1/merge`, `main`'
|
description: 'The branch that triggered the workflow run. e.g `1/merge`, `main`'
|
||||||
git_tag:
|
git_tag:
|
||||||
description: 'The tag that triggered the workflow run. e.g `v0.0.1`, `0.0.1`'
|
description: 'The tag that triggered the workflow run. e.g `v0.0.1`, `0.0.1`'
|
||||||
|
git_ref:
|
||||||
|
description: 'The git tag or branch that triggered this workflow, if tag is present this output will contain the tag, otherwise the branch name'
|
||||||
|
|
||||||
ci_hostname:
|
ci_hostname:
|
||||||
description: 'ci server hostname without http(s) prefix'
|
description: 'ci server hostname without http(s) prefix'
|
||||||
|
|||||||
5
dist/index.js
vendored
5
dist/index.js
vendored
@ -31155,6 +31155,7 @@ function collect_git(debug = false, output = false) {
|
|||||||
git_ref_branch : false,
|
git_ref_branch : false,
|
||||||
git_is_default_branch: false,
|
git_is_default_branch: false,
|
||||||
git_tag : false,
|
git_tag : false,
|
||||||
|
git_ref : false,
|
||||||
semver_valid : false,
|
semver_valid : false,
|
||||||
semver_major : false,
|
semver_major : false,
|
||||||
semver_minor : false,
|
semver_minor : false,
|
||||||
@ -31196,13 +31197,15 @@ function collect_git(debug = false, output = false) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
r.git_current_branch = github.context.ref.slice('refs/heads/'.length);
|
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_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
|
// parse semver for tags
|
||||||
if (r.git_is_tag) {
|
if (r.git_is_tag) {
|
||||||
r.git_tag = github.context.ref.slice('refs/tags/'.length);
|
r.git_tag = github.context.ref.slice('refs/tags/'.length);
|
||||||
|
r.git_ref = r.git_tag;
|
||||||
|
|
||||||
const parsed = parseSemVer(r.git_tag);
|
const parsed = parseSemVer(r.git_tag);
|
||||||
if (debug) {
|
if (debug) {
|
||||||
|
|||||||
@ -13,6 +13,7 @@ export function collect_git(debug = false, output = false) {
|
|||||||
git_ref_branch : false,
|
git_ref_branch : false,
|
||||||
git_is_default_branch: false,
|
git_is_default_branch: false,
|
||||||
git_tag : false,
|
git_tag : false,
|
||||||
|
git_ref : false,
|
||||||
semver_valid : false,
|
semver_valid : false,
|
||||||
semver_major : false,
|
semver_major : false,
|
||||||
semver_minor : 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_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_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
|
// parse semver for tags
|
||||||
if (r.git_is_tag) {
|
if (r.git_is_tag) {
|
||||||
r.git_tag = github.context.ref.slice('refs/tags/'.length);
|
r.git_tag = github.context.ref.slice('refs/tags/'.length);
|
||||||
|
r.git_ref = r.git_tag;
|
||||||
|
|
||||||
const parsed = semverParser.parseSemVer(r.git_tag);
|
const parsed = semverParser.parseSemVer(r.git_tag);
|
||||||
if (debug) {
|
if (debug) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user