-
Notifications
You must be signed in to change notification settings - Fork 28
Update activation comment with PR link after create_pull_request #3502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add GH_AW_COMMENT_ID and GH_AW_COMMENT_REPO environment variables to create_pull_request job - Implement updateActivationComment function in create_pull_request.cjs - Support both issue/PR comments (REST API) and discussion comments (GraphQL) - Append PR link to activation comment after successful PR creation - Add comprehensive tests for the new functionality Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| * @param {string} pullRequestUrl - URL of the created pull request | ||
| * @param {number} pullRequestNumber - Number of the pull request | ||
| */ | ||
| async function updateActivationComment(pullRequestUrl, pullRequestNumber) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot move to separate .cjs file that gets imported. update compiler and bundler for requires.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored into separate file update_activation_comment.cjs that gets imported via require(). Updated compiler and bundler to handle the require. Commit: bb45c8a
- Extract updateActivationComment function to update_activation_comment.cjs - Update create_pull_request.cjs to use require() for the extracted function - Add update_activation_comment.cjs to GetJavaScriptSources() in js.go - Create comprehensive tests for update_activation_comment.cjs - Update create_pull_request.test.cjs to use mock function - All tests pass (758 JS tests, all Go unit tests) Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this 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 adds functionality to update activation comments with a link to the created pull request. When a workflow is triggered by an issue or discussion comment and subsequently creates a pull request, the original activation comment is updated with a reference to the new PR.
Key Changes:
- New JavaScript module
update_activation_comment.cjsthat updates issue/discussion comments with PR links - Integration with
create_pull_request.cjsto automatically call the update function after PR creation - Environment variable passing from Go to provide activation comment context
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/js/update_activation_comment.cjs | New utility module that handles updating both issue comments (REST API) and discussion comments (GraphQL) with PR links |
| pkg/workflow/js/update_activation_comment.test.cjs | Comprehensive test suite covering various scenarios including issue comments, discussion comments, missing comment IDs, and error handling |
| pkg/workflow/js/create_pull_request.cjs | Updated to import and call the new updateActivationComment function after successfully creating a PR |
| pkg/workflow/js/create_pull_request.test.cjs | Updated tests to mock the updateActivationComment function and verify it's called with correct parameters |
| pkg/workflow/js.go | Registered the new utility module in the JavaScript sources map for bundling |
| pkg/workflow/create_pull_request.go | Added environment variable passing for GH_AW_COMMENT_ID and GH_AW_COMMENT_REPO to the safe output job |
| docs/src/content/docs/status.mdx | Updated workflow path reference from super-linter-report.md to super-linter.md |
| Multiple .lock.yml files | Generated workflow files with the bundled JavaScript including the new updateActivationComment function inlined |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot fix tests |
- Add test for invalid comment_repo format validation - Add test for deleted discussion comment (null body) - Add test for deleted discussion comment (null node) - Add test for deleted issue comment (null body in REST API) - Add test for deleted issue comment (undefined body in REST API) - All 763 JavaScript tests pass - All Go unit tests pass Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| script: | | ||
| const fs = require("fs"); | ||
| const crypto = require("crypto"); | ||
| const { updateActivationComment } = require("./update_activation_comment.cjs"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot make sure bundled inlines this require
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bundler now inlines the require statement. Created getCreatePullRequestScript() with lazy bundling using sync.Once pattern. All require("./update_activation_comment.cjs") statements are now inlined in compiled workflows. Commit: b63e92a
- Move createPullRequestScript from js.go to scripts.go as createPullRequestScriptSource
- Add bundling with sync.Once pattern for lazy bundling
- Create getCreatePullRequestScript() getter function
- Update create_pull_request.go to use getter instead of direct variable
- Update js_test.go to use getter for testing
- All require("./update_activation_comment.cjs") statements now inlined in compiled workflows
- All 763 JavaScript tests pass
- All Go unit tests pass
- All 74 workflows recompiled successfully
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Refactor: Extract updateActivationComment to separate file
Extracted the
updateActivationCommentfunction fromcreate_pull_request.cjsinto a separate reusable module as requested.Changes
New File:
update_activation_comment.cjsUpdated:
create_pull_request.cjsrequire("./update_activation_comment.cjs")at topupdateActivationComment(github, context, core, url, number)Updated:
js.go//go:embeddirective forupdate_activation_comment.cjsGetJavaScriptSources()map for bundler supportUpdated:
scripts.go//go:embedUpdated:
create_pull_request.goNew File:
update_activation_comment.test.cjsUpdated:
create_pull_request.test.cjsupdateActivationCommentfunction to dependenciesTest Results
✅ All JavaScript tests pass (763 tests)
✅ All Go unit tests pass
✅ Build successful
✅ Code formatting verified
✅ Linting passes
✅ All 74 workflows recompiled successfully
✅ No require statements in compiled workflows - all properly bundled
Bundling Verification
The bundler now properly inlines the
require("./update_activation_comment.cjs")statement:The refactoring follows existing patterns in the codebase (similar to how
sanitize_content.cjs,load_agent_output.cjs, etc. are structured).Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.