@@ -273,19 +273,25 @@ jobs:
273273 });
274274 pr = data;
275275 } catch (prError) {
276- core.setFailed(`Failed to get PR #${targetPrNumber}: ${prError.message}. The PR may have been closed or deleted.`);
276+ const msg = `Failed to get PR #${targetPrNumber}: ${prError.message}. The PR may have been closed or deleted.`;
277+ core.setOutput('error_message', msg);
278+ core.setFailed(msg);
277279 return;
278280 }
279281
280282 // Check if PR is still open
281283 if (pr.state !== 'open') {
282- core.setFailed(`PR #${targetPrNumber} is ${pr.state}. Can only push to open PRs.`);
284+ const msg = `PR #${targetPrNumber} is ${pr.state}. Can only push to open PRs.`;
285+ core.setOutput('error_message', msg);
286+ core.setFailed(msg);
283287 return;
284288 }
285289
286290 // Check if PR is from a fork (not supported)
287291 if (pr.head.repo.full_name !== `${context.repo.owner}/${context.repo.repo}`) {
288- core.setFailed(`PR #${targetPrNumber} is from a fork. Cannot push to fork branches.`);
292+ const msg = `PR #${targetPrNumber} is from a fork. Cannot push to fork branches.`;
293+ core.setOutput('error_message', msg);
294+ core.setFailed(msg);
289295 return;
290296 }
291297
@@ -563,9 +569,11 @@ jobs:
563569
564570 let body = `@${comment_user} ❌ ${actionVerb} failed.\n\n`;
565571
566- // Check for extract step error first
567- if (extractError) {
568- body += `**Error:** ${extractError}\n\n`;
572+ // Check for errors from various steps
573+ const targetError = process.env.TARGET_ERROR || '';
574+ const errorMessage = extractError || targetError;
575+ if (errorMessage) {
576+ body += `**Error:** ${errorMessage}\n\n`;
569577 } else if (toolOutput) {
570578 // Extract just the error lines (skip build output)
571579 const lines = toolOutput.split('\n');
@@ -594,6 +602,7 @@ jobs:
594602 ACTION_VERB : ${{ steps.extract-command.outputs.action_verb }}
595603 TOOL_OUTPUT : ${{ steps.run-tool.outputs.tool_output }}
596604 EXTRACT_ERROR : ${{ steps.extract-command.outputs.error_message }}
605+ TARGET_ERROR : ${{ steps.determine-target.outputs.error_message }}
597606
598607 - name : Re-lock issue/PR if it was locked
599608 if : github.event.issue.locked == true && (success() || failure())
0 commit comments