diff --git a/action.yml b/action.yml index 4558f25..101ae9b 100644 --- a/action.yml +++ b/action.yml @@ -26,6 +26,8 @@ outputs: description: 'The branch that triggered the workflow run. e.g `1/merge`, `main`' git_tag: 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: description: 'ci server hostname without http(s) prefix' diff --git a/dist/index.js b/dist/index.js index 1c92803..ccbba1b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -31155,6 +31155,7 @@ 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, @@ -31196,13 +31197,15 @@ 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 = parseSemVer(r.git_tag); if (debug) { diff --git a/src/collect_git.js b/src/collect_git.js index 5ee3f28..11d9ab2 100644 --- a/src/collect_git.js +++ b/src/collect_git.js @@ -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) {