mirror of
https://github.com/github/codeql-action
synced 2026-05-23 20:00:54 +03:00
Address more comments from PR
This commit is contained in:
Generated
+1
-2
@@ -98,8 +98,7 @@ const getCommitOid = async function (checkoutPath, ref = "HEAD") {
|
||||
"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: ${stderr}`);
|
||||
core.info(`Could not determine current commit SHA using git. Continuing with data from user input or environment. ${stderr}`);
|
||||
}
|
||||
return (0, exports.getOptionalInput)("sha") || (0, util_1.getRequiredEnvParam)("GITHUB_SHA");
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Generated
+8
-8
@@ -224,22 +224,22 @@ const util_1 = require("./util");
|
||||
infoStub.restore();
|
||||
});
|
||||
(0, ava_1.default)("determineMergeBaseCommitOid no error", async (t) => {
|
||||
const stub = sinon.stub(core, "info");
|
||||
const infoStub = sinon.stub(core, "info");
|
||||
process.env["GITHUB_EVENT_NAME"] = "pull_request";
|
||||
process.env["GITHUB_SHA"] = "100912429fab4cb230e66ffb11e738ac5194e73a";
|
||||
await actionsUtil.determineMergeBaseCommitOid(path.join(__dirname, "../.."));
|
||||
t.deepEqual(1, stub.callCount);
|
||||
t.assert(stub.firstCall.args[0].startsWith("The checkout path provided to the action does not appear to be a git repository."));
|
||||
stub.restore();
|
||||
t.deepEqual(1, infoStub.callCount);
|
||||
t.assert(infoStub.firstCall.args[0].startsWith("The checkout path provided to the action does not appear to be a git repository."));
|
||||
infoStub.restore();
|
||||
});
|
||||
(0, ava_1.default)("determineMergeBaseCommitOid other error", async (t) => {
|
||||
const stub = sinon.stub(core, "info");
|
||||
const infoStub = sinon.stub(core, "info");
|
||||
process.env["GITHUB_EVENT_NAME"] = "pull_request";
|
||||
process.env["GITHUB_SHA"] = "100912429fab4cb230e66ffb11e738ac5194e73a";
|
||||
const result = await actionsUtil.determineMergeBaseCommitOid(path.join(__dirname, "../../i-dont-exist"));
|
||||
t.deepEqual(result, undefined);
|
||||
t.deepEqual(1, stub.callCount);
|
||||
t.assert(stub.firstCall.args[0].startsWith("Failed to call git to determine merge base."));
|
||||
stub.restore();
|
||||
t.deepEqual(1, infoStub.callCount);
|
||||
t.assert(infoStub.firstCall.args[0].startsWith("Failed to call git to determine merge base."));
|
||||
infoStub.restore();
|
||||
});
|
||||
//# sourceMappingURL=actions-util.test.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -282,23 +282,23 @@ test("determineMergeBaseCommitOid non-pullrequest", async (t) => {
|
||||
});
|
||||
|
||||
test("determineMergeBaseCommitOid no error", async (t) => {
|
||||
const stub = sinon.stub(core, "info");
|
||||
const infoStub = sinon.stub(core, "info");
|
||||
|
||||
process.env["GITHUB_EVENT_NAME"] = "pull_request";
|
||||
process.env["GITHUB_SHA"] = "100912429fab4cb230e66ffb11e738ac5194e73a";
|
||||
await actionsUtil.determineMergeBaseCommitOid(path.join(__dirname, "../.."));
|
||||
t.deepEqual(1, stub.callCount);
|
||||
t.deepEqual(1, infoStub.callCount);
|
||||
t.assert(
|
||||
stub.firstCall.args[0].startsWith(
|
||||
infoStub.firstCall.args[0].startsWith(
|
||||
"The checkout path provided to the action does not appear to be a git repository.",
|
||||
),
|
||||
);
|
||||
|
||||
stub.restore();
|
||||
infoStub.restore();
|
||||
});
|
||||
|
||||
test("determineMergeBaseCommitOid other error", async (t) => {
|
||||
const stub = sinon.stub(core, "info");
|
||||
const infoStub = sinon.stub(core, "info");
|
||||
|
||||
process.env["GITHUB_EVENT_NAME"] = "pull_request";
|
||||
process.env["GITHUB_SHA"] = "100912429fab4cb230e66ffb11e738ac5194e73a";
|
||||
@@ -306,12 +306,12 @@ test("determineMergeBaseCommitOid other error", async (t) => {
|
||||
path.join(__dirname, "../../i-dont-exist"),
|
||||
);
|
||||
t.deepEqual(result, undefined);
|
||||
t.deepEqual(1, stub.callCount);
|
||||
t.deepEqual(1, infoStub.callCount);
|
||||
t.assert(
|
||||
stub.firstCall.args[0].startsWith(
|
||||
infoStub.firstCall.args[0].startsWith(
|
||||
"Failed to call git to determine merge base.",
|
||||
),
|
||||
);
|
||||
|
||||
stub.restore();
|
||||
infoStub.restore();
|
||||
});
|
||||
|
||||
+1
-2
@@ -91,8 +91,7 @@ export const getCommitOid = async function (
|
||||
);
|
||||
} 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: ${stderr}`,
|
||||
`Could not determine current commit SHA using git. Continuing with data from user input or environment. ${stderr}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user