Refactor update job builders to use shared helper pattern#5789
Merged
Refactor update job builders to use shared helper pattern#5789
Conversation
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor safe output update jobs to eliminate code duplication
Refactor update job builders to use shared helper pattern
Dec 7, 2025
This was referenced Dec 7, 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.
The update-issue, update-pull-request, and update-release job builders duplicated ~120 lines of identical scaffolding: guard clauses, environment variable construction, SafeOutputJobConfig wiring, and condition building.
Changes
Created
update_entity_helpers.gowith parameterized builders following theclose_entity_helpers.gopattern:UpdateEntityJobParamsstruct to specify job-specific details (permissions, outputs, scripts)buildUpdateEntityJob()consolidates the common job construction logicparseUpdateEntityConfig()handles shared config parsing with type-specific field callbacksRefactored concrete builders to use helpers:
UpdateEntityConfigfor common fieldsUpdateIssuesConfig.Status) remain in concrete typesExample
Before (repeated 3x with minor variations):
After:
Future update types (e.g., update-discussion) can reuse the same pattern with minimal code.
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/user/usr/bin/gh gh api user --jq .login it/ref/tags/v5 GO111MODULE ps GOINSECURE GOMOD GOMODCACHE ps -go.�� -go.git GO111MODULE e/git GOINSECURE GOMOD GOMODCACHE e/git(http block)/usr/bin/gh gh api user --jq .login .git .git /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/node GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api user --jq .login b-script.git b-script.git ec431a0c15fe40a1d0c375aea5dfcee66bc/log.json GOINSECURE GOMOD GOMODCACHE 1/x64/bin/npm env -json GO111MODULE(http block)If you need me to access, download, or install something from one of these locations, you can either:
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.