Add global.context setup before all scripts with actions/github-script#7459
Merged
Add global.context setup before all scripts with actions/github-script#7459
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
reviewed
Dec 24, 2025
.github/workflows/archie.lock.yml
Outdated
| global.context = context; | ||
| global.exec = exec; | ||
| global.io = io; | ||
| async function main() { |
Contributor
There was a problem hiding this comment.
@copilot require the .cjs file and call main instead of inlining
Contributor
Author
There was a problem hiding this comment.
Changed to use require() pattern instead of inlining. Updated checkout_pr_branch.cjs to export the main function and modified pr.go to conditionally use require when setup action is available. (c69a0f1)
Copilot
AI
changed the title
[WIP] Store context in global for all inlined scripts
Add global.context setup before all inlined scripts with actions/github-script
Dec 24, 2025
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
Add global.context setup before all inlined scripts with actions/github-script
Add global.context setup before all scripts with actions/github-script
Dec 24, 2025
pelikhan
approved these changes
Dec 24, 2025
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.
Bundled JavaScript scripts may contain
require()calls for built-in Node.js modules (fs,path,crypto) that execute during module loading. Without globals set up beforehand, code executing at module-load time cannot access GitHub Actions variables likecontext,core,github.Changes
Added
global.context = context(pluscore,github,exec,io) setup before all JavaScript inactions/github-scriptsteps, whether usingrequire()or inline mode:Activation job scripts (
compiler_activation_jobs.go):Safe output scripts (
compiler_safe_outputs_core.go):Participant & PR scripts:
copilot_participant_steps.go: assign_issue, add_copilot_reviewerpr.go: PR checkout script (now usesrequire()when setup action is available)create_issue.go: assign_copilot_to_created_issuesrole_checks.go: membership checkScript updates:
checkout_pr_branch.cjs: Updated to exportmainfunction for use withrequire()patternExample
With require() (when setup action is available):
With inline mode (fallback):
This ensures consistent global variable availability across both
require()-based and inline script loading patterns.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.