@@ -79613,8 +79613,8 @@ var require_utils4 = __commonJS({
7961379613 const { sourceBranch, targetBranch } = getSourceAndTargetBranches();
7961479614 if (sourceBranch && targetBranch) {
7961579615 try {
79616- yield git(["fetch", "origin"]);
79617- const output = yield gitOutput(["merge-base", "origin/" + sourceBranch, "origin/" + targetBranch], {
79616+ yield git(["fetch", "origin"], true );
79617+ const output = yield gitOutput(["merge-base", "origin/" + sourceBranch, "origin/" + targetBranch], false, {
7961879618 ignoreReturnCode: true
7961979619 });
7962079620 if (output.exitCode === 0) {
@@ -79635,13 +79635,13 @@ To enable prMode, consider adding "fetchDepth: 0".`;
7963579635 return "";
7963679636 });
7963779637 }
79638- function git(args_1) {
79639- return __awaiter2(this, arguments, void 0, function* (args, options = {}) {
79640- return (yield gitOutput(args, options)).exitCode;
79638+ function git(args_1, withCredentials_1 ) {
79639+ return __awaiter2(this, arguments, void 0, function* (args, withCredentials, options = {}) {
79640+ return (yield gitOutput(args, withCredentials, options)).exitCode;
7964179641 });
7964279642 }
79643- function gitOutput(args_1) {
79644- return __awaiter2(this, arguments, void 0, function* (args, options = {}) {
79643+ function gitOutput(args_1, withCredentials_1 ) {
79644+ return __awaiter2(this, arguments, void 0, function* (args, withCredentials, options = {}) {
7964579645 const result2 = {
7964679646 exitCode: 0,
7964779647 stdout: "",
@@ -79661,8 +79661,16 @@ To enable prMode, consider adding "fetchDepth: 0".`;
7966179661 });
7966279662 options.outStream = outStream;
7966379663 options.errStream = errStream;
79664+ if (withCredentials && process.env.SYSTEM_ACCESSTOKEN !== void 0) {
79665+ args = [
79666+ "-c",
79667+ `http.extraheader="AUTHORIZATION: bearer $SYSTEM_ACCESSTOKEN"`,
79668+ ...args
79669+ ];
79670+ }
7966479671 result2.exitCode = yield tl2.execAsync("git", args, options).catch((error) => {
79665- tl2.warning(`Failed to run git command with arguments: ${args.join(" ")}`);
79672+ tl2.warning(`Failed to run git command with arguments: ${args.join(" ")}.
79673+ Error: ${error.message}`);
7966679674 throw error;
7966779675 });
7966879676 if (result2.stdout.startsWith("[command]")) {
@@ -79765,29 +79773,29 @@ ${comment_tag_pattern}`;
7976579773 }
7976679774 currentBranch = currentBranch.replace("refs/heads/", "");
7976779775 currentBranch = (0, qodana_12.validateBranchName)(currentBranch);
79768- const currentCommit = (yield gitOutput(["rev-parse", "HEAD"])).stdout.trim();
79769- yield git(["config", "user.name", output_12.COMMIT_USER]);
79770- yield git(["config", "user.email", output_12.COMMIT_EMAIL]);
79771- yield git(["add", "."]);
79772- let exitCode = yield git(["commit", "-m", commitMessage], {
79776+ const currentCommit = (yield gitOutput(["rev-parse", "HEAD"], false )).stdout.trim();
79777+ yield git(["config", "user.name", output_12.COMMIT_USER], false );
79778+ yield git(["config", "user.email", output_12.COMMIT_EMAIL], false );
79779+ yield git(["add", "."], false );
79780+ let exitCode = yield git(["commit", "-m", commitMessage], false, {
7977379781 ignoreReturnCode: true
7977479782 });
7977579783 if (exitCode !== 0) {
7977679784 return;
7977779785 }
79778- exitCode = yield git(["pull", "--rebase", "origin", currentBranch]);
79786+ exitCode = yield git(["pull", "--rebase", "origin", currentBranch], true );
7977979787 if (exitCode !== 0) {
7978079788 return;
7978179789 }
7978279790 if (mode === qodana_12.BRANCH) {
79783- const commitToCherryPick = (yield gitOutput(["rev-parse", "HEAD"])).stdout.trim();
79784- yield git(["checkout", currentBranch]);
79785- yield git(["cherry-pick", commitToCherryPick]);
79791+ const commitToCherryPick = (yield gitOutput(["rev-parse", "HEAD"], false )).stdout.trim();
79792+ yield git(["checkout", currentBranch], false );
79793+ yield git(["cherry-pick", commitToCherryPick], false );
7978679794 yield gitPush(currentBranch);
7978779795 console.log(`Pushed quick-fixes to branch ${currentBranch}`);
7978879796 } else if (mode === qodana_12.PULL_REQUEST) {
7978979797 const newBranch = `qodana/quick-fixes-${currentCommit.slice(0, 7)}`;
79790- yield git(["checkout", "-b", newBranch]);
79798+ yield git(["checkout", "-b", newBranch], false );
7979179799 yield gitPush(newBranch);
7979279800 yield createPr(commitMessage, currentBranch, newBranch);
7979379801 console.log(`Pushed quick-fixes to branch ${newBranch} and created pull request`);
@@ -79799,11 +79807,13 @@ ${comment_tag_pattern}`;
7979979807 }
7980079808 function gitPush(branch) {
7980179809 return __awaiter2(this, void 0, void 0, function* () {
79802- const output = yield gitOutput(["push", "origin", branch], {
79810+ const output = yield gitOutput(["push", "origin", branch], true, {
7980379811 ignoreReturnCode: true
7980479812 });
7980579813 if (output.exitCode !== 0) {
79806- tl2.warning(`Failed to push branch ${branch}: ${output.stderr}`);
79814+ tl2.warning(`Failed to push branch ${branch}.
79815+ Stdout: ${output.stdout}
79816+ Stderr: ${output.stderr}`);
7980779817 }
7980879818 });
7980979819 }
0 commit comments