You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
? `git am ${base_switches} ${additional_switches} changes.patch`
142
-
: `git am ${base_switches} changes.patch`;
167
+
? `git am ${base_switches} ${additional_switches} ${patch_file}`
168
+
: `git am ${base_switches} ${patch_file}`;
143
169
let git_am_output = `$ ${git_am_command}\n\n`;
144
170
let git_am_failed = false;
145
171
try {
@@ -155,21 +181,52 @@ jobs:
155
181
}
156
182
157
183
if (git_am_failed) {
158
-
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!`;
159
-
await github.rest.issues.createComment({
160
-
owner: repo_owner,
161
-
repo: repo_name,
162
-
issue_number: pr_number,
163
-
body: git_am_failed_body
164
-
});
165
-
core.setFailed("Error: git am failed, most likely due to a merge conflict.");
// If no resolution command supplied, fail immediately
187
+
if (resolution_command.trim().length === 0) {
188
+
const details = `${wrap_in_code_block('console', git_am_output)}\n[Link to workflow output](${workflow_run_url})`;
189
+
const git_am_failed_body = `@${comment_user} backporting to \`${target_branch}\` failed, the patch most likely resulted in conflicts. Please backport manually!\n${wrap_in_details_block('git am output', details)}`;
190
+
postComment(git_am_failed_body);
191
+
core.setFailed("git am failed, most likely due to a merge conflict.");
192
+
return;
193
+
}
194
+
195
+
console.log(`git am failed; attempting in-session conflict resolution via provided command: ${resolution_command}`);
console.log("Backport temp branch already exists, skipping opening a PR.");
175
232
return;
@@ -210,19 +267,12 @@ jobs:
210
267
211
268
console.log("Successfully opened the GitHub PR.");
212
269
} catch (error) {
213
-
270
+
const body = `@${comment_user} an error occurred while backporting to \`${target_branch}\`. See the [workflow output](${workflow_run_url}) for details.`;
271
+
const comment_url = await postComment(body);
272
+
console.log(`Posted comment: ${comment_url}`);
214
273
core.setFailed(error);
215
-
216
-
// post failure to GitHub comment
217
-
const unknown_error_body = `@${comment_user} an error occurred while backporting to "${target_branch}", please check the run log for details!\n\n${error.message}`;
0 commit comments