Skip to content

Support deployment controls on workflow environments - #74938

Merged
pelikhan merged 6 commits into
mainfrom
copilot/support-deployment-false-environment
Nov 5, 2026
Merged

pelikhan merged 6 commits into
mainfrom
copilot/support-deployment-false-environment

Conversation

Copilot AI commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Environments used only to gate credentials currently create unnecessary deployment records. This change allows disabling deployment creation while retaining environment secrets and protection rules.

  • Schema: Accept boolean or expression-valued deployment in top-level environment, safe-outputs.environment, and jobs.<id>.environment.
  • Compiler coverage: Verify the complete environment object survives inheritance and overrides across generated jobs. Leave compiler pass-through and CLI overrides unchanged.
  • Documentation: Add secrets-only examples and clarify default and override behavior.
safe-outputs:
  environment:
    name: protected-write-secrets
    deployment: false

Omitting deployment preserves existing behavior.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for deployment false on environment Support deployment controls on workflow environments Nov 4, 2026
Copilot AI requested a review from pelikhan November 4, 2026 20:08
@pelikhan
pelikhan marked this pull request as ready for review November 4, 2026 22:40
Copilot AI adaptive review requested due to automatic review settings November 4, 2026 22:40
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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.

Generated from Test Quality Sentinel · routed: gpt56 max · ~1 AIC · ⌖ ~1 AIC · ⊞ 6.3K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #74938

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 deployment in 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)

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (>100 new lines) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/74938-support-deployment-controls-on-workflow-environments.md — review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 Evidence and next steps

The gate found 202 new lines in the default business-logic directories. The PR changes the environment schema in pkg/parser/schemas/main_workflow_schema.json, adds parser and compiler coverage under pkg/, and documents the new boolean or expression-valued deployment setting. The PR body and linked issue describe the decision, but neither contains all four required ADR sections.

  1. Review the draft ADR committed to your branch.

  2. Complete or refine its context, decision rationale, alternatives, and consequences.

  3. Reference it in this PR body, for example:

    ADR: ADR-74938: Support Deployment Controls on Workflow Environments (link unavailable: invalid HTTPS URL)

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 reference

An ADR must contain these four sections: Context, Decision, Alternatives Considered, and Consequences, including positive and negative trade-offs.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: gpt56 max · ~2 AIC · ⌖ ~2 AIC · ⊞ 7.7K · ◷
Comment /review to run again

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-04T22:43:58Z
review_event: REQUEST_CHANGES
top_themes:
  - deployment control is dropped when manual approval takes precedence
files_reviewed:
  - docs/src/content/docs/reference/frontmatter.md
  - docs/src/content/docs/reference/safe-outputs.md
  - pkg/parser/schema_environment_test.go
  - pkg/parser/schemas/main_workflow_schema.json
  - pkg/workflow/environment_deployment_test.go
comment_count: 1

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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 in schema_environment_test.go.
    • If we skip it: Compiler coverage stays coupled to 12 identical cases.
  2. 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 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.

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

Comment on lines +18 to +25
for _, tc := range []struct {
name string
deployment any
}{
{"false", false},
{"true", true},
{"expression", "${{ github.ref_name == 'main' }}"},
{"omitted", nil},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reduced compiler coverage to one representative deployment: false value; accepted-value cases remain in the schema tests. Commit: 36d7525.

Comment on lines +101 to +109
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)
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the redundant loop; the explicit safe-job and agent-job assertions remain. Commit: 36d7525.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.json now accepts environment.deployment, but docs/src/content/docs/reference/frontmatter-full.md and docs/public/editor/autocomplete-data.json do 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-triage returned 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

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (docs/src/content/docs/reference/frontmatter.md:616): 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. - Support deployment controls on workflow environments #74938 (comment)
  3. Review (pkg/workflow/environment_deployment_test.go:25): 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. - Support deployment controls on workflow environments #74938 (comment)
  4. Review (pkg/workflow/environment_deployment_test.go:109): 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. - Support deployment controls on workflow environments #74938 (comment)
  5. Review (pkg/parser/schemas/main_workflow_schema.json:3194): [/codebase-design] Please regenerate the schema-derived docs and editor metadata before merging; the new field is currently missing from both generated authoring surfaces. - Support deployment controls on workflow environments #74938 (comment)

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-work: 4d4c025bd1678dbc94ce5be2707f5f1cea89d4ac9872069b1e5496b7342e12b3 5214b708d1feb70c162c4c273c2effb4586af17c2b63983d26aa711456401f70 53b323121041b01616e735672868d841dbedc0ceeb4347dea68c17fce1d7cd04 c7de760c571622be91b9635801a3baca30bebd522ce4460143d0046e147b8f76
Sous-chef requested-state: 0ba4cd0b80573bde8bb8781ece61fbdab890b841266828eb48cfbf8bcefc0e5a

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~19 AIC · ⌖ ~10 AIC · ⊞ 1.2K · ◷
Comment /souschef to run again

Copilot AI commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

Copilot assignment requested for the following outstanding work:...

Sous-chef requested-head: c6ec90d
Sous-chef requested-work: 4d4c025bd1678dbc94ce5be2707f5f1cea89d4ac9872069b1e5496b7342e12b3 5214b708d1feb70c162c4c273c2effb4586af17c2b63983d26aa711456401f70 53b323121041b01616e735672868d841dbedc0ceeb4347dea68c17fce1d7cd04 c7de760c571622be91b9635801a3baca30bebd522ce4460143d0046e147b8f76
Sous-chef requested-state: 0ba4cd0b80573bde8bb8781ece61fbdab890b841266828eb48cfbf8bcefc0e5a

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.

Copilot AI and others added 2 commits November 5, 2026 06:15
…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>
@pelikhan

pelikhan commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

@copilot update actions/Aw linter AST

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@copilot update actions/Aw linter AST

Added Actions/AW AST and linter regression coverage in eddd549. Existing environment mappings already preserve deployment; tests now verify parsing, lowering, edits, round-trips, compiler-view isolation, and full linting without mutation. All three affected package suites and the final validation gate pass.

@pelikhan
pelikhan merged commit 48b7273 into main Nov 5, 2026
38 checks passed
@pelikhan
pelikhan deleted the copilot/support-deployment-false-environment branch November 5, 2026 19:53
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.1

github-actions Bot added a commit that referenced this pull request Nov 7, 2026
…ory app auth, environment deployment

Sync .github/aw with #75323, #74941, #74937, and #74938.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support deployment: false on environment (top-level and safe-outputs.environment)

4 participants