build: refresh js files
This commit is contained in:
parent
57a28594b9
commit
f9b0c1f2ea
6 changed files with 46 additions and 9 deletions
28
lib/actions-util.js
generated
28
lib/actions-util.js
generated
|
|
@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.restoreInputs = exports.persistInputs = exports.CommandInvocationError = exports.getFileType = exports.FileCmdNotFoundError = exports.decodeGitFilePath = exports.getGitDiffHunkHeaders = exports.getAllGitMergeBases = exports.gitFetch = exports.deepenGitHistory = exports.determineBaseBranchHeadCommitOid = exports.getCommitOid = exports.getOptionalInput = exports.getRequiredInput = void 0;
|
exports.restoreInputs = exports.persistInputs = exports.CommandInvocationError = exports.getFileType = exports.FileCmdNotFoundError = exports.decodeGitFilePath = exports.getGitDiffHunkHeaders = exports.getAllGitMergeBases = exports.gitRepack = exports.gitFetch = exports.deepenGitHistory = exports.determineBaseBranchHeadCommitOid = exports.getCommitOid = exports.getOptionalInput = exports.getRequiredInput = void 0;
|
||||||
exports.getTemporaryDirectory = getTemporaryDirectory;
|
exports.getTemporaryDirectory = getTemporaryDirectory;
|
||||||
exports.getRef = getRef;
|
exports.getRef = getRef;
|
||||||
exports.getActionVersion = getActionVersion;
|
exports.getActionVersion = getActionVersion;
|
||||||
|
|
@ -183,14 +183,21 @@ const determineBaseBranchHeadCommitOid = async function (checkoutPathOverride) {
|
||||||
};
|
};
|
||||||
exports.determineBaseBranchHeadCommitOid = determineBaseBranchHeadCommitOid;
|
exports.determineBaseBranchHeadCommitOid = determineBaseBranchHeadCommitOid;
|
||||||
/**
|
/**
|
||||||
* Deepen the git history of the given ref by one level. Errors are logged.
|
* Deepen the git history of HEAD by one level. Errors are logged.
|
||||||
*
|
*
|
||||||
* This function uses the `checkout_path` to determine the repository path and
|
* This function uses the `checkout_path` to determine the repository path and
|
||||||
* works only when called from `analyze` or `upload-sarif`.
|
* works only when called from `analyze` or `upload-sarif`.
|
||||||
*/
|
*/
|
||||||
const deepenGitHistory = async function () {
|
const deepenGitHistory = async function () {
|
||||||
try {
|
try {
|
||||||
await runGitCommand((0, exports.getOptionalInput)("checkout_path"), ["fetch", "--no-tags", "--deepen=1"], "Cannot deepen the shallow repository.");
|
await runGitCommand((0, exports.getOptionalInput)("checkout_path"), [
|
||||||
|
"fetch",
|
||||||
|
"origin",
|
||||||
|
"HEAD",
|
||||||
|
"--no-tags",
|
||||||
|
"--no-recurse-submodules",
|
||||||
|
"--deepen=1",
|
||||||
|
], "Cannot deepen the shallow repository.");
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
// Errors are already logged by runGitCommand()
|
// Errors are already logged by runGitCommand()
|
||||||
|
|
@ -212,6 +219,21 @@ const gitFetch = async function (branch, extraFlags) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
exports.gitFetch = gitFetch;
|
exports.gitFetch = gitFetch;
|
||||||
|
/**
|
||||||
|
* Repack the git repository, using with the given flags. Errors are logged.
|
||||||
|
*
|
||||||
|
* This function uses the `checkout_path` to determine the repository path and
|
||||||
|
* works only when called from `analyze` or `upload-sarif`.
|
||||||
|
*/
|
||||||
|
const gitRepack = async function (flags) {
|
||||||
|
try {
|
||||||
|
await runGitCommand((0, exports.getOptionalInput)("checkout_path"), ["repack", ...flags], "Cannot repack the repository.");
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
// Errors are already logged by runGitCommand()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
exports.gitRepack = gitRepack;
|
||||||
/**
|
/**
|
||||||
* Compute the all merge bases between the given refs. Returns an empty array
|
* Compute the all merge bases between the given refs. Returns an empty array
|
||||||
* if no merge base is found, or if there is an error.
|
* if no merge base is found, or if there is an error.
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
11
lib/analyze.js
generated
11
lib/analyze.js
generated
|
|
@ -162,7 +162,7 @@ async function setupDiffInformedQueryRun(baseRef, headRef, codeql, logger, featu
|
||||||
if (!(await features.getValue(feature_flags_1.Feature.DiffInformedQueries, codeql))) {
|
if (!(await features.getValue(feature_flags_1.Feature.DiffInformedQueries, codeql))) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return await (0, logging_1.withGroup)("Generating diff range extension pack", async () => {
|
return await (0, logging_1.withGroupAsync)("Generating diff range extension pack", async () => {
|
||||||
const diffRanges = await getPullRequestEditedDiffRanges(baseRef, headRef, logger);
|
const diffRanges = await getPullRequestEditedDiffRanges(baseRef, headRef, logger);
|
||||||
return writeDiffRangeDataExtensionPack(logger, diffRanges);
|
return writeDiffRangeDataExtensionPack(logger, diffRanges);
|
||||||
});
|
});
|
||||||
|
|
@ -185,7 +185,7 @@ async function getPullRequestEditedDiffRanges(baseRef, headRef, logger) {
|
||||||
}
|
}
|
||||||
// To compute the merge bases between the base branch and the PR topic branch,
|
// To compute the merge bases between the base branch and the PR topic branch,
|
||||||
// we need to fetch the commit graph from the branch heads to those merge
|
// we need to fetch the commit graph from the branch heads to those merge
|
||||||
// babes. The following 4-step procedure does so while limiting the amount of
|
// babes. The following 6-step procedure does so while limiting the amount of
|
||||||
// history fetched.
|
// history fetched.
|
||||||
// Step 1: Deepen from the PR merge commit to the base branch head and the PR
|
// Step 1: Deepen from the PR merge commit to the base branch head and the PR
|
||||||
// topic branch head, so that the PR merge commit is no longer considered a
|
// topic branch head, so that the PR merge commit is no longer considered a
|
||||||
|
|
@ -203,7 +203,12 @@ async function getPullRequestEditedDiffRanges(baseRef, headRef, logger) {
|
||||||
// Step 4: Fetch the base branch history, stopping when we reach commits that
|
// Step 4: Fetch the base branch history, stopping when we reach commits that
|
||||||
// are reachable from the PR topic branch head.
|
// are reachable from the PR topic branch head.
|
||||||
await actionsUtil.gitFetch(baseRef, [`--shallow-exclude=${headRef}`]);
|
await actionsUtil.gitFetch(baseRef, [`--shallow-exclude=${headRef}`]);
|
||||||
// Step 5: Deepen the history so that we have the merge bases between the base
|
// Step 5: Repack the history to remove the shallow grafts that were added by
|
||||||
|
// the previous fetches. This step works around a bug that causes subsequent
|
||||||
|
// deepening fetches to fail with "fatal: error in object: unshallow <SHA>".
|
||||||
|
// See https://stackoverflow.com/q/63878612
|
||||||
|
await actionsUtil.gitRepack(["-d"]);
|
||||||
|
// Step 6: Deepen the history so that we have the merge bases between the base
|
||||||
// branch and the PR topic branch.
|
// branch and the PR topic branch.
|
||||||
await actionsUtil.deepenGitHistory();
|
await actionsUtil.deepenGitHistory();
|
||||||
// To compute the exact same diff as GitHub would compute for the PR, we need
|
// To compute the exact same diff as GitHub would compute for the PR, we need
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
10
lib/logging.js
generated
10
lib/logging.js
generated
|
|
@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getActionsLogger = getActionsLogger;
|
exports.getActionsLogger = getActionsLogger;
|
||||||
exports.getRunnerLogger = getRunnerLogger;
|
exports.getRunnerLogger = getRunnerLogger;
|
||||||
exports.withGroup = withGroup;
|
exports.withGroup = withGroup;
|
||||||
|
exports.withGroupAsync = withGroupAsync;
|
||||||
exports.formatDuration = formatDuration;
|
exports.formatDuration = formatDuration;
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
function getActionsLogger() {
|
function getActionsLogger() {
|
||||||
|
|
@ -65,6 +66,15 @@ function withGroup(groupName, f) {
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
async function withGroupAsync(groupName, f) {
|
||||||
|
core.startGroup(groupName);
|
||||||
|
try {
|
||||||
|
return await f();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
core.endGroup();
|
||||||
|
}
|
||||||
|
}
|
||||||
/** Format a duration for use in logs. */
|
/** Format a duration for use in logs. */
|
||||||
function formatDuration(durationMs) {
|
function formatDuration(durationMs) {
|
||||||
if (durationMs < 1000) {
|
if (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