Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

Update compiler to gracefully report PR checkout failures

This PR addresses the issue where checking out a PR branch fails (typically when the PR is closed) without a clear user-facing message.

Plan

  • Update checkout_pr_branch.cjs to write a step summary when checkout fails
  • Add helpful message indicating the PR may be closed
  • Update tests to verify step summary is written on failure
  • Test the changes manually to ensure proper error handling
  • Move error message content to markdown template file

Changes

Modified Files:

  1. actions/setup/js/checkout_pr_branch.cjs - Load and render markdown template for PR checkout failure
  2. actions/setup/js/checkout_pr_branch.test.cjs - Updated tests to mock template file reading and rendering
  3. actions/setup/md/pr_checkout_failure.md - New markdown template with error message content

What was changed:

  • Moved error message content from inline string to actions/setup/md/pr_checkout_failure.md
  • Updated code to use renderTemplate from messages_core.cjs for consistent template rendering
  • Template uses {error_message} placeholder for dynamic error content
  • Tests mock both the template file reading and the rendering function

Validation:

  • ✅ All JavaScript tests pass (17 tests in checkout_pr_branch.test.cjs)
  • ✅ Code formatting validated (Go + JavaScript)
  • ✅ Linting passed
Original prompt

Reference: https://github.com/githubnext/gh-aw/actions/runs/21596137840/job/62229095212#step:7:1

Update the compiler to gracefully report that checking out the PR branch failed, which typically means that the pull request was closed.

When checking out the PR branch fails, write message to step summary about failure.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update compiler to report checkout failure gracefully Add step summary for PR checkout failures Feb 2, 2026
Copilot AI requested a review from pelikhan February 2, 2026 15:44
const errorMsg = getErrorMessage(error);

// Write to step summary to provide context about the failure
const summaryContent = `## ❌ Failed to Checkout PR Branch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot move to .md file in actions/setup/md and render file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 82eac8d. Moved the error message content to actions/setup/md/pr_checkout_failure.md and updated the code to load and render the template using renderTemplate from messages_core.cjs.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan February 2, 2026 15:54
@pelikhan pelikhan marked this pull request as ready for review February 2, 2026 15:55
@pelikhan pelikhan merged commit 2b5dc78 into main Feb 2, 2026
87 checks passed
@pelikhan pelikhan deleted the copilot/update-compiler-error-reporting branch February 2, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants