Skip to content

Update activation comment when PR creation fails and issue is created#3780

Merged
pelikhan merged 3 commits into
mainfrom
copilot/update-issue-comments-on-failure
Nov 13, 2025
Merged

Update activation comment when PR creation fails and issue is created#3780
pelikhan merged 3 commits into
mainfrom
copilot/update-issue-comments-on-failure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 13, 2025

When create-pull-request falls back to creating an issue (on push or PR creation failure), the activation comment was not being updated with the issue link, unlike successful PR creation.

Changes

  • update_activation_comment.cjs: Added optional itemType parameter ("pull_request" | "issue") to support both item types. Defaults to "pull_request" for backward compatibility.

  • create_pull_request.cjs: Added updateActivationComment() calls in both fallback scenarios:

    • Push failure fallback (line 451)
    • PR creation failure fallback (line 585)
  • update_activation_comment.test.cjs: Added tests for issue link updates via REST API and GraphQL.

Example

// Now works for both scenarios
await updateActivationComment(github, context, core, pr.html_url, pr.number); // PR
await updateActivationComment(github, context, core, issue.html_url, issue.number, "issue"); // Issue

Generated messages:

  • PR: ✅ Pull request created: [#42](url)
  • Issue: ✅ Issue created: [#99](url)
Original prompt

When using the create-pull-request action, if it fails and an issue is created instead, we should update any comment made during the activation phase to reference the newly created issue—just like we do when a pull request is created successfully.


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

Copilot AI and others added 2 commits November 13, 2025 00:43
…d issue is created

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…reation

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update comments to reference new issues on create-pull-request failure Update activation comment when PR creation fails and issue is created Nov 13, 2025
Copilot AI requested a review from pelikhan November 13, 2025 00:50
@pelikhan pelikhan marked this pull request as ready for review November 13, 2025 01:00
Copilot AI review requested due to automatic review settings November 13, 2025 01:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the create-pull-request action to update activation comments with issue links when PR creation fails and falls back to creating an issue, maintaining consistency with the existing behavior for successful PR creation.

Key changes:

  • Added optional itemType parameter to updateActivationComment() function to support both pull requests and issues
  • Integrated activation comment updates in both fallback scenarios (push failure and PR creation failure)
  • Added comprehensive test coverage for the new issue link functionality

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.

File Description
pkg/workflow/js/update_activation_comment.cjs Added itemType parameter (defaults to "pull_request") to support updating comments with either PR or issue links, with corresponding message formatting
pkg/workflow/js/update_activation_comment.test.cjs Added two new test cases covering issue link updates via both REST API and GraphQL for discussion comments
pkg/workflow/js/create_pull_request.cjs Integrated updateActivationComment() calls in both fallback scenarios (lines 452 and 586) to update activation comments when issues are created
.github/workflows/*.lock.yml Updated compiled workflow files with bundled JavaScript changes, ensuring consistency across all workflow lock files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pelikhan pelikhan merged commit 9700a55 into main Nov 13, 2025
76 of 80 checks passed
@pelikhan pelikhan deleted the copilot/update-issue-comments-on-failure branch November 13, 2025 02:24
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.

3 participants