Fix lock/unlock issue scripts to support both require() and inline modes#7444
Merged
Fix lock/unlock issue scripts to support both require() and inline modes#7444
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
… main function scheme - Updated lock-issue.cjs and unlock-issue.cjs to export main function via module.exports - Added await main() execution at the end for inline mode - Modified compiler to bundle lock-issue script when inlining (removes module.exports) - Scripts now work in both require mode (setup action) and inline mode (direct YAML embedding) - All JavaScript tests pass (17/17) Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
approved these changes
Dec 23, 2025
actions/setup/js/lock-issue.cjs
Outdated
| module.exports = { main }; | ||
|
|
||
| // Execute when inlined (not when required) | ||
| await main(); |
Contributor
There was a problem hiding this comment.
@copilot do not call main, let importer call it
Contributor
Author
There was a problem hiding this comment.
Removed await main() from lock-issue.cjs. The setup action files now only export the main function - the importer calls it. (commit 75b7509)
actions/setup/js/unlock-issue.cjs
Outdated
| module.exports = { main }; | ||
|
|
||
| // Execute when inlined (not when required) | ||
| await main(); |
Contributor
There was a problem hiding this comment.
@copilot do not call main, let importer call it
Contributor
Author
There was a problem hiding this comment.
Removed await main() from unlock-issue.cjs. The setup action files now only export the main function - the importer calls it. (commit 75b7509)
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix inlining for lock and unlock scripts for main function support
Fix lock/unlock issue scripts to support both require() and inline modes
Dec 23, 2025
The setup action files (actions/setup/js/*.cjs) should only export the main function via module.exports, not auto-execute. The importer (require() caller) is responsible for calling await main(). When bundling for inline mode, the compiler now adds await main() after bundling. Changes: - Removed await main() from pkg/workflow/js/lock-issue.cjs - Removed await main() from pkg/workflow/js/unlock-issue.cjs - Modified compiler to add await main() when bundling for inline mode - Rebuilt actions with updated scripts (no await main() in setup files) Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The lock-issue and unlock-issue scripts needed to support two execution modes: require() mode (when used with setup action) and inline mode (when bundled and embedded in YAML).
Changes
Scripts (
lock-issue.cjs,unlock-issue.cjs):module.exports = { main }for require() compatibilityawait main()Compiler (
compiler_activation_jobs.go):BundleJavaScriptWithMode()module.exportsviaremoveExports()for inline modeawait main();after bundling for inline mode executionExecution Modes
Require mode (setup action - primary):
Inline mode (direct YAML embedding - fallback):
The scripts now correctly support both execution modes. Setup action files only export the main function, allowing the importer to control execution timing.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.