refactor: split safe_outputs_config.go into focused modules#20639
refactor: split safe_outputs_config.go into focused modules#20639
Conversation
- Extract GitHub App config/token generation into safe_outputs_app_config.go (341 lines) - Extract messages/mentions parsing into safe_outputs_messages_config.go (153 lines) - Reduce safe_outputs_config.go from 1077 to 605 lines - All public APIs preserved; no behavioral changes - Build and tests pass Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Replace safeOutputsConfigLog with safeOutputMessagesLog in parseMentionsConfig to use the logger defined in the same file Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Hey One thing worth addressing before this moves out of draft:
If you'd like a hand adding that coverage signal, here's a ready-to-use prompt:
|
There was a problem hiding this comment.
Pull request overview
Refactors pkg/workflow/safe_outputs_config.go by splitting it into smaller, domain-focused modules while preserving the existing APIs and behavior, and fixes a stale logger reference in mentions parsing.
Changes:
- Extracted GitHub App configuration parsing/merging and token step generation into
safe_outputs_app_config.go. - Extracted messages + mentions parsing/serialization helpers into
safe_outputs_messages_config.go(including correcting the logger used inparseMentionsConfig). - Reduced
safe_outputs_config.goto focus on frontmatter extraction / base config parsing and removed now-unneeded imports.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/workflow/safe_outputs_config.go | Removes app/messages domains from the monolith file; retains frontmatter extraction/base parsing and cleans up imports. |
| pkg/workflow/safe_outputs_app_config.go | New module containing GitHubAppConfig, include-merge logic, and GitHub App token mint/invalidate step builders. |
| pkg/workflow/safe_outputs_messages_config.go | New module containing messages parsing, mentions parsing (with corrected logger), and JSON serialization for env passing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
pkg/workflow/safe_outputs_config.gohad grown to 1077 lines spanning three unrelated domains: frontmatter extraction, GitHub App token lifecycle, and messages/mentions parsing.Split
safe_outputs_config.goextractSafeOutputsConfig,parseBaseSafeOutputConfig)safe_outputs_app_config.goGitHubAppConfig, token mint/invalidation steps,resolveActivationToken, config mergingsafe_outputs_messages_config.goparseMessagesConfig,parseMentionsConfig,serializeMessagesConfig,setStringFromMapNo behavioral changes. All public APIs preserved. Also fixes a stale logger reference —
parseMentionsConfigwas usingsafeOutputsConfigLogfrom the original file instead of the localsafeOutputMessagesLog.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE go k/gh�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD ode-gyp-bin/node-json go(http block)If you need me to access, download, or install something from one of these locations, you can either:
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.