Skip to content

Commit

Permalink
Handle conflicts in backport GH Action
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Jan 10, 2025
1 parent 526bf5c commit 168538c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/backport-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ jobs:
await exec.exec(`git config user.name "github-actions"`);
await exec.exec(`git config user.email "[email protected]"`);
const git_am_command = "git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch";
let git_am_command = "git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch";
let git_am_output = `$ ${git_am_command}\n\n`;
let git_am_failed = false;
try {
Expand Down Expand Up @@ -184,7 +184,9 @@ jobs:
return;
}
const git_am_failed_body = `@${context.payload.comment.user.login} backporting to ${target_branch} failed, the patch most likely resulted in conflicts:\n\n\`\`\`shell\n${git_am_output}\n\`\`\`\n\nPlease backport manually!\n**NOTE:** A PR will be created, but needs to be revised manually!**`;
git_am_command = "git am --continue";
git_am_output = `$ ${git_am_command}\n\n`;
const git_am_failed_body = `@${context.payload.comment.user.login} backporting to ${target_branch} failed, the patch most likely resulted in conflicts:\n\n\`\`\`shell\n${git_am_output}\n\`\`\`\n\n**NOTE:** A PR will be created, but needs to be revised manually!**`;
await github.rest.issues.createComment({
owner: repo_owner,
repo: repo_name,
Expand All @@ -195,12 +197,9 @@ jobs:
await exec.exec(`git add .`);
await exec.exec(`git restore --staged changes.patch`);
const git_am_continue_command = "git am --continue";
let git_am_output = `$ ${git_am_continue_command}\n\n`;
let git_am_failed = false;
git_am_failed = false;
try {
await exec.exec(git_am_continue_command, [], {
await exec.exec(git_am_command, [], {
listeners: {
stdout: function stdout(data) { git_am_output += data; },
stderr: function stderr(data) { git_am_output += data; }
Expand Down

0 comments on commit 168538c

Please sign in to comment.