Skip to content

feat(cycle): environments & deployment-protection cycle (#12) - #28

Merged
lex00 merged 1 commit into
mainfrom
feat/environments-cycle
Jun 19, 2026
Merged

lex00 merged 1 commit into
mainfrom
feat/environments-cycle

Conversation

@lex00

@lex00 lex00 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Closes #12.

Adds the environments cycle — reconciles deployment environments and their protection.

What it does

  • GET /repos/{o}/{r}/environments (list) → mapped from protection_rules (wait timer, required reviewers, prevent-self-review) + deployment_branch_policy.
  • PUT /repos/{o}/{r}/environments/{env} (create/update, idempotent).
  • DELETE …/environments/{env} (ownership-gated).

New types

  • Config: EnvironmentConfig (+ EnvironmentReviewer, DeploymentBranchPolicy) on RepoConfig.environments.
  • Diff: LiveEnvironment + diffEnvironments → new environment resource type (key <repo>/<env>), added to RESOURCE_TYPE_ORDER.

RMW (the issue's emphasis: "preserve undeclared protection rules")

The environment PUT replaces the supplied config, so apply seeds the body from the live environment (via the change-set before, or a re-fetch if absent) and overlays only declared fields. A config that sets only waitTimer preserves required reviewers and the branch policy — covered by a dedicated test, plus a re-fetch-when-before-absent test.

Verification

  • npx tsc --noEmit clean
  • npm test green (358 tests; +15 in environments.test.ts)
  • Action bundle rebuilt for the CI freshness check

🤖 Generated with Claude Code

Reconciles deployment environments — required reviewers, wait timers,
self-review prevention, deployment branch policies — via PUT/DELETE
/repos/{o}/{r}/environments/{env}. New EnvironmentConfig + LiveEnvironment
+ environment diff type. RMW apply seeds the full-replacement PUT from
live (or re-fetches) so undeclared protection is preserved.

Registered, exported, action bundle rebuilt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lex00
lex00 merged commit 9d7a44f into main Jun 19, 2026
2 checks passed
@lex00 lex00 mentioned this pull request Jun 19, 2026
1 task
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.

cycle: environments & deployment-protection

1 participant