Conversation
…SON env vars - Refactor generate_safe_outputs_tools.cjs to export main() function and support GH_AW_TOOLS_META_JSON / GH_AW_VALIDATION_JSON env var payloads - Update mcp_setup_generator.go to generate actions/github-script step instead of heredoc + node invocation - Update integration test to parse tools_meta from env var instead of heredoc - Recompile all 181 workflow lock files Agent-Logs-Url: https://github.com/github/gh-aw/sessions/fb0ab97d-a4d2-4950-b3b7-0112a2c60381 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Hey This PR looks ready for maintainer review:
One note: the PR is currently in draft state — when you're happy with the implementation, mark it ready for review so Contribution check result: 🟢 Aligned —
|
|
🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation... |
|
✅ All tools validated successfully! Agent Container Smoke Test confirms agent container is ready. |
|
📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing... |
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
Agent Container Tool Check
Result: 12/12 tools available ✅ Overall Status: PASS
|
|
Overall:
|
There was a problem hiding this comment.
This PR cleanly replaces fragile heredoc + direct node invocation with actions/github-script and env var JSON payloads. The refactoring is well-structured: generate_safe_outputs_tools.cjs gains a proper exported main(), error handling uses throw instead of process.exit(1), and the test updates correctly reflect the new GH_AW_TOOLS_META_JSON pattern. Nice work!
📰 BREAKING: Report filed by Smoke Copilot · ● 1.6M
| if (require.main === module) { | ||
| main().catch(err => { | ||
| process.exit(1); | ||
| }); | ||
| } |
There was a problem hiding this comment.
Good refactor — exporting main and guarding with require.main === module preserves backward compatibility while enabling actions/github-script integration. The throw new Error(msg) pattern also lets the caller handle failures cleanly instead of process.exit(1).
| fmt.Fprintf(yaml, " uses: %s\n", GetActionPin("actions/github-script")) | ||
| yaml.WriteString(" with:\n") | ||
| yaml.WriteString(" script: |\n") | ||
| yaml.WriteString(generateGitHubScriptWithRequire("generate_safe_outputs_tools.cjs")) | ||
|
|
||
| // Note: The MCP server entry point (mcp-server.cjs) is now copied by actions/setup |
There was a problem hiding this comment.
Using YAML literal block scalar env vars instead of heredocs is a cleaner approach — no randomized delimiters needed, and actions/github-script handles the JSON payload safely. This should resolve the fragile heredoc + direct node invocation issue.
There was a problem hiding this comment.
💥 Automated smoke test review - all systems nominal!
💥 [THE END] — Illustrated by Smoke Claude · ● 229.8K
| { | ||
| "description_suffixes": { | ||
| "add_comment": " CONSTRAINTS: Maximum 10 comment(s) can be added.", | ||
| "create_discussion": " CONSTRAINTS: Maximum 2 discussion(s) can be created.", |
There was a problem hiding this comment.
The migration from run: | heredoc to actions/github-script with JSON env vars is a clean approach. Consider adding a comment to document why JSON env vars are preferred over heredoc for future maintainers.
| GH_AW_TOOLS_META_JSON: | | ||
| { | ||
| "description_suffixes": { | ||
| "create_discussion": " CONSTRAINTS: Maximum 1 discussion(s) can be created. Discussions will be created in category \"agent-research\"." |
There was a problem hiding this comment.
Consistent pattern with other lock files - good to see the migration is applied uniformly across all workflows. The GH_AW_TOOLS_META_JSON and GH_AW_VALIDATION_JSON env var approach improves readability.
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
Summary
Converts the "Write Safe Outputs Tools" step (step 31, referenced in https://github.com/github/gh-aw/actions/runs/24028507303/job/70072190053#step:31:1) from shell heredocs + direct
nodeinvocation toactions/github-scriptwith JSON payloads passed as environment variables.Problem
The step was using:
tools_meta.jsonandvalidation.jsonto disknode ${RUNNER_TEMP}/gh-aw/actions/generate_safe_outputs_tools.cjsinvocationThis caused failures (exit code 1 from the node invocation) and is fragile due to direct
nodeinvocation.Changes
actions/setup/js/generate_safe_outputs_tools.cjsasync function main()GH_AW_TOOLS_META_JSONenv var: if set, writes the JSON content totools_meta.jsonbefore processing (replaces heredoc)GH_AW_VALIDATION_JSONenv var: if set, writes the JSON content tovalidation.json(replaces heredoc)process.exit(1)withthrow new Error()(actions/github-script handles it properly)require.main === moduleguard for backward-compatible standalonenodeexecutionpkg/workflow/mcp_setup_generator.gonodeinvocation step with anactions/github-scriptsteptoolsMetaJSON,validationConfigJSON) are embedded as YAML literal block scalar env vars (GH_AW_TOOLS_META_JSON,GH_AW_VALIDATION_JSON)generateGitHubScriptWithRequire("generate_safe_outputs_tools.cjs")patternpkg/workflow/safe_outputs_tools_meta_integration_test.goextractToolsMetaFromLockFileto findGH_AW_TOOLS_META_JSON: |env var instead of heredoc delimiterLock files
.lock.ymlfiles recompiled with the new step formatGenerated YAML (before → after)
Before:
After:
✨ PR Review Safe Output Test - Run 24035225148