From bedbb2c292cd13cc58b2ae92372abb8de8725cba Mon Sep 17 00:00:00 2001 From: Paul Hatcherian <1835615+PaulHatch@users.noreply.github.com> Date: Sat, 25 Jan 2020 12:16:40 -0500 Subject: [PATCH] Use input branch name instead of GitHub environment variable for generating release link --- dist/index.js | 9 ++++----- index.js | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/dist/index.js b/dist/index.js index 92aa5f1..564126f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -654,7 +654,7 @@ const cmd = async (command, ...args) => { return output; }; -const setOutput = (major, minor, patch, increment, changed) => { +const setOutput = (major, minor, patch, increment, changed, branch) => { const format = core.getInput('format', { required: true }); var version = format .replace('${major}', major) @@ -665,11 +665,10 @@ const setOutput = (major, minor, patch, increment, changed) => { const tag = tagPrefix + version; const repository = process.env.GITHUB_REPOSITORY; - const branch = process.env.GITHUB_REF; core.info(`Version is ${major}.${minor}.${patch}+${increment}`); if (repository !== undefined) { - core.info(`To create a release for this version, go to https://github.com/${repository}/releases/new?tag=${tag}&target=${branch}`); + core.info(`To create a release for this version, go to https://github.com/${repository}/releases/new?tag=${tag}&target=${branch.trim()}`); } core.setOutput("version", version); core.setOutput("major", major.toString()); @@ -699,7 +698,7 @@ async function run() { if (lastCommitAll === '') { // empty repo - setOutput('0', '0', '0', '0', changed); + setOutput('0', '0', '0', '0', changed, branch); return; } @@ -784,7 +783,7 @@ async function run() { patch++; } - setOutput(major, minor, patch, increment, changed); + setOutput(major, minor, patch, increment, changed, branch); } catch (error) { core.error(error); diff --git a/index.js b/index.js index 09f7c18..43233f1 100644 --- a/index.js +++ b/index.js @@ -18,7 +18,7 @@ const cmd = async (command, ...args) => { return output; }; -const setOutput = (major, minor, patch, increment, changed) => { +const setOutput = (major, minor, patch, increment, changed, branch) => { const format = core.getInput('format', { required: true }); var version = format .replace('${major}', major) @@ -29,11 +29,10 @@ const setOutput = (major, minor, patch, increment, changed) => { const tag = tagPrefix + version; const repository = process.env.GITHUB_REPOSITORY; - const branch = process.env.GITHUB_REF; core.info(`Version is ${major}.${minor}.${patch}+${increment}`); if (repository !== undefined) { - core.info(`To create a release for this version, go to https://github.com/${repository}/releases/new?tag=${tag}&target=${branch}`); + core.info(`To create a release for this version, go to https://github.com/${repository}/releases/new?tag=${tag}&target=${branch.trim()}`); } core.setOutput("version", version); core.setOutput("major", major.toString()); @@ -63,7 +62,7 @@ async function run() { if (lastCommitAll === '') { // empty repo - setOutput('0', '0', '0', '0', changed); + setOutput('0', '0', '0', '0', changed, branch); return; } @@ -148,7 +147,7 @@ async function run() { patch++; } - setOutput(major, minor, patch, increment, changed); + setOutput(major, minor, patch, increment, changed, branch); } catch (error) { core.error(error);