Deduplicate GitHub Script step scaffold in safe_outputs_steps.go - #50105
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
✅ Test Quality Sentinel completed test quality analysis. No test files were added or modified in this PR. PR #50105 is a production code refactoring (safe_outputs_steps.go deduplication with net −36 lines) with no test changes. Test Quality Sentinel analysis skipped. |
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ |
|
✅ PR Code Quality Reviewer completed the code quality review. |
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. No ADR enforcement needed: PR #50105 does not have the 'implementation' label and has only 16 new lines of code in business logic directories (threshold: 100). |
There was a problem hiding this comment.
Pull request overview
Deduplicates GitHub Script step generation while preserving wrapper behavior.
Changes:
- Extracts the shared scaffold into one helper.
- Keeps download handling configurable.
- Applies optional step conditions consistently.
Show a summary per file
| File | Description |
|---|---|
pkg/workflow/safe_outputs_steps.go |
Consolidates duplicated step-building logic. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Balanced
| } | ||
|
|
||
| return steps | ||
| return c.buildGitHubScriptStepCommon(data, config, true) |
There was a problem hiding this comment.
Clean, correct refactoring. The deduplication is well-structured and the StepCondition fix (now active in both paths) is a genuine improvement. No issues found.
🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 15.6 AIC · ⌖ 9.27 AIC · ⊞ 5.4K
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /tdd and /codebase-design — one suggestion on test coverage.
📋 Summary
Positive Highlights
- ✅ Clean extraction of
buildGitHubScriptStepCommon— single source of truth, no drift risk - ✅ Both public methods correctly reduced to thin logging wrappers
- ✅ The
StepConditionfix (now honored in the download path too) is a real correctness improvement - ✅ Compiled
.lock.ymloutput is byte-identical — safe to land
One Gap
The StepCondition behavior in the download path is newly enabled but untested. Inline comment added with a suggested test skeleton.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 37 AIC · ⌖ 13.2 AIC · ⊞ 7.1K
Comment /matt to run again
Comments that could not be inline-anchored
pkg/workflow/safe_outputs_steps.go:177
[/tdd] StepCondition is now active for the download path (buildGitHubScriptStep) for the first time, but there is no test covering this behavior.
The PR description notes this as an intentional fix ("previously only wired in the no-download variant"). A unit test asserting that if: always() appears in the generated YAML when StepCondition is set via the download path would prevent future regression.
<details>
<summary>💡 Suggested test skeleton</summary>
func TestBuildGitHu…
</details>There was a problem hiding this comment.
Verdict: COMMENT
Clean, low-risk deduplication with no behavior change.
Analysis
- Verified the only caller of
buildGitHubScriptStep(safe_outputs_jobs.go:106) never setsStepCondition, confirming the PR's claim that behavior is unchanged for that path. - Ran
TestBuildGitHubScriptStep*suite — all pass. - The shared
buildGitHubScriptStepCommoncorrectly gates the artifact-download steps behindincludeDownload, matching prior per-function logic. - No correctness, concurrency, or security issues found in the diff. Naming and structure are reasonable; no dead code or duplication introduced.
🔎 Code quality review by PR Code Quality Reviewer · auto · 33.9 AIC · ⌖ 5.03 AIC · ⊞ 7.9K
Comment /review to run again
|
@copilot quick triage for this PR:
|
|
🎉 This pull request is included in a new release. Release: |
buildGitHubScriptStepandbuildGitHubScriptStepWithoutDownloadwere near-identical implementations of the same YAML step scaffold (name/id/uses/env/with/script), differing only in artifact download handling and an optionalif:condition — leaving two places to update and room for drift.Changes
buildGitHubScriptStepCommon(data, config, includeDownload bool) []stringholding the single copy of the scaffold: step metadata, optionalStepCondition, env vars, token selection, and script rendering (inline orrequire()).includeDownloadtrue/false.Behavior is unchanged; the download-variant still emits
buildAgentOutputDownloadStepsfirst, andStepConditionis honored in both paths (previously only wired in the no-download variant, which was the only caller setting it). Compiled.lock.ymlfiles are byte-identical.Run: https://github.com/github/gh-aw/actions/runs/30860632229