Repository navigation
Support deployment controls on workflow environments - #74938
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
This comment has been minimized.
This comment has been minimized.
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Ponytail Reviewer completed successfully!
|
There was a problem hiding this comment.
🟢 Approval recommended
The review reports no active issues with the environment deployment controls change.
No open issues 🎉
What changed in this PR
Adds environment deployment controls to gh-aw, allowing workflows to retain environment secrets and protection rules without creating deployment records. This addresses #73200 while preserving existing behavior when deployment is omitted.
Changes:
- Accept boolean or expression-valued
deploymentin top-level, safe-output, and custom-job environments. - Add schema validation and compiler tests for environment preservation, inheritance, and overrides.
- Document secrets-only environments, default behavior, and whole-block CLI overrides.
| File | Description |
|---|---|
pkg/workflow/environment_deployment_test.go |
Tests environment preservation across generated jobs and overrides. |
pkg/parser/schemas/main_workflow_schema.json |
Allows deployment in all three environment object schemas. |
pkg/parser/schema_environment_test.go |
Tests accepted and rejected deployment values. |
docs/src/content/docs/reference/safe-outputs.md |
Adds a credentials-only environment example. |
docs/src/content/docs/reference/frontmatter.md |
Documents deployment controls, defaults, and CLI override behavior. |
Review effort: Balanced (auto)
🏗️ Design Decision Gate — ADR RequiredThis PR makes significant changes to core business logic (>100 new lines) but does not have a linked Architecture Decision Record (ADR). 📄 Draft ADR committed:
📋 Evidence and next stepsThe gate found 202 new lines in the default business-logic directories. The PR changes the environment schema in
Once the ADR is linked in the PR body, this gate will re-run and verify that the implementation matches the decision. 📋 Michael Nygard ADR format referenceAn ADR must contain these four sections: Context, Decision, Alternatives Considered, and Consequences, including positive and negative trade-offs.
|
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Found one correctness gap: the new deployment control is dropped when manual approval takes precedence, so the documented secrets-only behavior is not preserved in that configuration. Please preserve, reject, or explicitly document this interaction and add coverage.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
|
|
||
| The activation job inherits this environment, including its deployment protection rules. If [`on.manual-approval`](/gh-aw/reference/triggers/#manual-approval-gates-manual-approval) is configured, its environment takes precedence for the activation job. | ||
|
|
||
| The object form accepts `name`, optional `url`, and optional `deployment` (a boolean or GitHub Actions expression, such as `${{ github.ref_name == 'main' }}`). For environments that only gate secrets, set `deployment: false` to retain environment secrets and protection rules—including branch policies, required reviewers, and wait timers—without creating deployment records: |
There was a problem hiding this comment.
The documented top-level deployment: false is not preserved when on.manual-approval is configured, because the activation job switches to a bare environment: <manual-approval> string; this still creates a deployment record and defeats the secrets-only behavior for that configuration.
💡 Preserve or document the interaction
buildActivationEnvironment gives the manual-approval environment precedence and discards the top-level object. Either carry the deployment control through the manual-approval path (if supported), reject or warn on the incompatible combination, and add a regression test; otherwise explicitly document that deployment: false does not apply when manual approval is enabled.
There was a problem hiding this comment.
Updated activation environment assembly to replace the object’s name with the manual-approval environment while retaining settings such as deployment: false; added regression coverage. Commit: 36d7525.
There was a problem hiding this comment.
What this change does: It adds an optional deployment field to the three environment schema locations and documents how false keeps environment protections without creating deployment records. It adds schema validation and compiler propagation tests for the new object shape.
Should fix:
-
The compiler test repeats the same pass-through for four values (
pkg/workflow/environment_deployment_test.go:L18-L25)- What this is: The compiler copies this environment object through raw YAML and has no deployment-specific branch.
- Problem: The same fixture and job assertions repeat for
false,true, an expression, and omission at all three locations; the schema test already owns this type matrix. - Fix: Keep one representative value, such as
false, in the compiler test and leave the accepted-value cases inschema_environment_test.go. - If we skip it: Compiler coverage stays coupled to 12 identical cases.
-
The final propagation loop repeats the explicit checks (
pkg/workflow/environment_deployment_test.go:L101-L109)- What this is: This loop checks every environment-bearing job again after
safeJobsandagentJobsalready checked those same jobs. - Problem: In this fixture it adds no coverage but adds a second expected-value algorithm, including a type assertion and special-case branch.
- Fix: Delete the final loop and keep the explicit job-list assertions.
- If we skip it: The test has two places to update whenever its environment expectations change.
- What this is: This loop checks every environment-bearing job again after
Verdict: fix 1 and 2 first.
Not checked: Focused tests were blocked because the workspace has Go 1.26.9, go.mod requires 1.27.3, and the automatic toolchain download failed certificate validation.
Lean: -12 lines possible.
Generated by ✂️ Ponytail Reviewer for #74938 · codex · routed: gpt56 max · ~4 AIC · ⌖ ~1 AIC · ⊞ 118
Comment /ponytail to run again
| for _, tc := range []struct { | ||
| name string | ||
| deployment any | ||
| }{ | ||
| {"false", false}, | ||
| {"true", true}, | ||
| {"expression", "${{ github.ref_name == 'main' }}"}, | ||
| {"omitted", nil}, |
There was a problem hiding this comment.
Should fix: redundant compiler matrix — What this is: The compiler copies this environment object through raw YAML and has no branch for whether deployment is false, true, an expression, or omitted. Problem: The same fixture and job assertions are repeated for all four values at each of the three locations, while the schema test already owns the value-type matrix. Fix: Keep one representative value, such as false, here and leave the accepted-value cases in schema_environment_test.go. If we skip it: A compiler change must be maintained across 12 identical cases.
There was a problem hiding this comment.
Reduced compiler coverage to one representative deployment: false value; accepted-value cases remain in the schema tests. Commit: 36d7525.
| for name, job := range compiled.Jobs { | ||
| if env, ok := job["environment"]; ok { | ||
| expected := environment | ||
| if location == "override" && env.(map[string]any)["name"] == "agent-environment" { | ||
| expected = fields["environment"].(map[string]any) | ||
| } | ||
| assert.Equal(t, expected, env, "job %s must preserve the entire environment", name) | ||
| } | ||
| } |
There was a problem hiding this comment.
Should fix: duplicate propagation assertions — What this is: This loop checks every environment-bearing job again after safeJobs and agentJobs already checked those same jobs. Problem: In this fixture it adds no coverage but adds a second expected-value algorithm, including a type assertion and special-case branch. Fix: Delete the final loop and keep the explicit job-list assertions. If we skip it: The test has two places to update whenever its environment expectations change.
There was a problem hiding this comment.
Removed the redundant loop; the explicit safe-job and agent-job assertions remain. Commit: 36d7525.
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /codebase-design and /tdd. Requesting one change: regenerate the schema-derived documentation and editor metadata.
📋 Key Themes & Validation
- Generated contract drift:
pkg/parser/schemas/main_workflow_schema.jsonnow acceptsenvironment.deployment, butdocs/src/content/docs/reference/frontmatter-full.mdanddocs/public/editor/autocomplete-data.jsondo not expose it. The inline comment identifies the schema line. - Validation: The targeted parser and workflow tests passed, and the new compilation coverage preserves the environment object across inheritance and overrides.
- Skill selection:
pr-triagereturned malformed output, so the review used the documented fallback heuristic.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: gpt56 max · ~12 AIC · ⌖ ~1 AIC · ⊞ 5.4K
Comment /matt to run again
|
Copilot assignment requested for the following outstanding work:
Once you start work, post this work summary as a PR comment without the leading Copilot mention, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI. Sous-chef requested-head: c6ec90d
|
Sous-chef requested-head: c6ec90d Work summary: Updating from main, preserving the existing deployment-control changes, addressing the review feedback, regenerating authoring metadata, and validating the changes. I will not merge the PR or trigger CI. |
…yment-false-environment Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
@copilot update actions/Aw linter AST |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Added Actions/AW AST and linter regression coverage in |
|
🎉 This pull request is included in a new release. Release: |
Environments used only to gate credentials currently create unnecessary deployment records. This change allows disabling deployment creation while retaining environment secrets and protection rules.
deploymentin top-levelenvironment,safe-outputs.environment, andjobs.<id>.environment.Omitting
deploymentpreserves existing behavior.deployment: falseonenvironment(top-level andsafe-outputs.environment) #73200