Address comments from PR
This commit is contained in:
parent
d721f69753
commit
09940b4bb9
5 changed files with 30 additions and 23 deletions
24
lib/actions-util.js
generated
24
lib/actions-util.js
generated
|
|
@ -75,7 +75,7 @@ const getCommitOid = async function (checkoutPath, ref = "HEAD") {
|
|||
// the merge commit, which must mean that git is available.
|
||||
// Even if this does go wrong, it's not a huge problem for the alerts to
|
||||
// reported on the merge commit.
|
||||
let output = "";
|
||||
let stderr = "";
|
||||
try {
|
||||
let commitOid = "";
|
||||
await new toolrunner.ToolRunner(await safeWhich.safeWhich("git"), ["rev-parse", ref], {
|
||||
|
|
@ -85,7 +85,7 @@ const getCommitOid = async function (checkoutPath, ref = "HEAD") {
|
|||
commitOid += data.toString();
|
||||
},
|
||||
stderr: (data) => {
|
||||
output += data.toString();
|
||||
stderr += data.toString();
|
||||
},
|
||||
},
|
||||
cwd: checkoutPath,
|
||||
|
|
@ -93,11 +93,13 @@ const getCommitOid = async function (checkoutPath, ref = "HEAD") {
|
|||
return commitOid.trim();
|
||||
}
|
||||
catch (e) {
|
||||
if (output.includes("not a git repository")) {
|
||||
core.info("Could not determine current commit SHA using git. Continuing with data from user input or environment. The checkout path provided to the action does not appear to be a git repository.");
|
||||
if (stderr.includes("not a git repository")) {
|
||||
core.info("Could not determine current commit SHA using git. Continuing with data from user input or environment. " +
|
||||
"The checkout path provided to the action does not appear to be a git repository.");
|
||||
}
|
||||
else {
|
||||
core.info(`Could not determine current commit SHA using git. Continuing with data from user input or environment. Failed to call git to determine merge base. Continuing with data from environment: ${output}`);
|
||||
core.info(`Could not determine current commit SHA using git. Continuing with data from user input or environment. ` +
|
||||
`Failed to call git to determine merge base. Continuing with data from environment: ${stderr}`);
|
||||
}
|
||||
return (0, exports.getOptionalInput)("sha") || (0, util_1.getRequiredEnvParam)("GITHUB_SHA");
|
||||
}
|
||||
|
|
@ -113,7 +115,7 @@ const determineMergeBaseCommitOid = async function (checkoutPathOverride) {
|
|||
}
|
||||
const mergeSha = (0, util_1.getRequiredEnvParam)("GITHUB_SHA");
|
||||
const checkoutPath = checkoutPathOverride ?? (0, exports.getOptionalInput)("checkout_path");
|
||||
let output = "";
|
||||
let stderr = "";
|
||||
try {
|
||||
let commitOid = "";
|
||||
let baseOid = "";
|
||||
|
|
@ -135,7 +137,7 @@ const determineMergeBaseCommitOid = async function (checkoutPathOverride) {
|
|||
}
|
||||
},
|
||||
stderr: (data) => {
|
||||
output += data.toString();
|
||||
stderr += data.toString();
|
||||
},
|
||||
},
|
||||
cwd: checkoutPath,
|
||||
|
|
@ -149,11 +151,13 @@ const determineMergeBaseCommitOid = async function (checkoutPathOverride) {
|
|||
return undefined;
|
||||
}
|
||||
catch (e) {
|
||||
if (output.includes("not a git repository")) {
|
||||
core.info("The checkout path provided to the action does not appear to be a git repository. Continuing with data from environment.");
|
||||
if (stderr.includes("not a git repository")) {
|
||||
core.info("The checkout path provided to the action does not appear to be a git repository. " +
|
||||
"Will calculate the merge base on the server.");
|
||||
}
|
||||
else {
|
||||
core.info(`Failed to call git to determine merge base. Continuing with data from environment: ${output}`);
|
||||
core.info(`Failed to call git to determine merge base. Will calculate the merge base on ` +
|
||||
`the server. Reason: ${stderr}`);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue