Clean up destructuring
This commit is contained in:
@@ -98180,8 +98180,7 @@ function buildPullfrogFooter(params) {
|
||||
parts.push(`Using [${params.agent.displayName}](${params.agent.url})`);
|
||||
}
|
||||
if (params.workflowRun) {
|
||||
const { owner, repo, runId } = params.workflowRun;
|
||||
parts.push(`[View workflow run](https://github.com/${owner}/${repo}/actions/runs/${runId})`);
|
||||
parts.push(`[View workflow run](https://github.com/${params.workflowRun.owner}/${params.workflowRun.repo}/actions/runs/${params.workflowRun.runId})`);
|
||||
}
|
||||
if (params.customParts) {
|
||||
parts.push(...params.customParts);
|
||||
@@ -123859,9 +123858,8 @@ function setupGitConfig() {
|
||||
}
|
||||
}
|
||||
function setupGit(ctx) {
|
||||
const { githubInstallationToken: githubInstallationToken2, payload } = ctx;
|
||||
const repoDir = process.cwd();
|
||||
log.info("\u{1F527} Setting up git configuration...");
|
||||
log.info("\u{1F527} Setting up git authentication...");
|
||||
try {
|
||||
execSync("git config --local --unset-all http.https://github.com/.extraheader", {
|
||||
cwd: repoDir,
|
||||
@@ -123871,26 +123869,30 @@ function setupGit(ctx) {
|
||||
} catch {
|
||||
log.debug("No existing authentication headers to remove");
|
||||
}
|
||||
process.env.GH_TOKEN = githubInstallationToken2;
|
||||
$("git", ["config", "--local", "credential.helper", ""], { cwd: repoDir });
|
||||
$("git", ["config", "--local", "--add", "credential.helper", "!gh auth git-credential"], {
|
||||
cwd: repoDir
|
||||
});
|
||||
log.info("\u2713 Configured gh as credential helper");
|
||||
if (payload.event.is_pr !== true || !payload.event.issue_number) {
|
||||
const originUrl = `https://x-access-token:${ctx.githubInstallationToken}@github.com/${ctx.owner}/${ctx.name}.git`;
|
||||
$("git", ["remote", "set-url", "origin", originUrl], { cwd: repoDir });
|
||||
log.info("\u2713 Updated origin URL with authentication token");
|
||||
if (ctx.payload.event.is_pr !== true || !ctx.payload.event.issue_number) {
|
||||
log.debug("Not a PR event, staying on default branch");
|
||||
return { pushRemote: "origin" };
|
||||
}
|
||||
const prNumber = payload.event.issue_number;
|
||||
const prNumber = ctx.payload.event.issue_number;
|
||||
log.info(`\u{1F33F} Checking out PR #${prNumber}...`);
|
||||
$("gh", ["pr", "checkout", prNumber.toString()], {
|
||||
cwd: repoDir,
|
||||
env: { GH_TOKEN: githubInstallationToken2 }
|
||||
env: { GH_TOKEN: ctx.githubInstallationToken }
|
||||
});
|
||||
log.info(`\u2713 Successfully checked out PR #${prNumber}`);
|
||||
const pushRemote = detectPushRemote();
|
||||
if (pushRemote !== "origin") {
|
||||
log.info(`\u{1F374} Fork PR detected, will push to remote: ${pushRemote}`);
|
||||
const forkUrl = $("git", ["remote", "get-url", pushRemote], { cwd: repoDir, log: false });
|
||||
const authedForkUrl = forkUrl.replace(
|
||||
"https://github.com/",
|
||||
`https://x-access-token:${ctx.githubInstallationToken}@github.com/`
|
||||
);
|
||||
$("git", ["remote", "set-url", pushRemote, authedForkUrl], { cwd: repoDir });
|
||||
log.info(`\u2713 Updated ${pushRemote} URL with authentication token`);
|
||||
}
|
||||
return { pushRemote };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user