Skip to content

feat(environment): add prevent_self_review support#641

Open
gdams wants to merge 1 commit into
eclipse-csi:mainfrom
gdams:feat/environment-deployment-protection
Open

feat(environment): add prevent_self_review support#641
gdams wants to merge 1 commit into
eclipse-csi:mainfrom
gdams:feat/environment-deployment-protection

Conversation

@gdams
Copy link
Copy Markdown
Contributor

@gdams gdams commented Apr 21, 2026

Summary

Adds support for the prevent_self_review setting on deployment environments.

When enabled, this prevents the user who triggered a deployment from being able to approve their own deployment when required reviewers are configured — a common compliance requirement for production environments.

API

The field is a top-level boolean on GitHub's Environment API payload (prevent_self_review), so it flows through otterdog's default from/to provider mappings without any extra transformation logic.

Example

environments+: [
  orgs.newEnvironment('production') {
    reviewers+: ['@my-org/platform-team'],
    prevent_self_review: true,
  },
],

Changes

  • otterdog/models/environment.py — new prevent_self_review: bool field.
  • examples/template/otterdog-defaults.libsonnet — default prevent_self_review: false on newEnvironment.
  • otterdog/resources/schemas/environment.json — new boolean property.
  • tests/models/test_environment.py + github-environment.json + otterdog-environment.json — updated to cover the new field.

Follow-ups (not in this PR)

Custom GitHub App deployment protection rules (managed via /repos/{owner}/{repo}/environments/{env}/deployment_protection_rules) require separate endpoints and a more complex model. Intentionally left as a separate change.

Testing

  • poetry run pytest tests/ → 243 passed, 2 skipped, 0 failures
  • poetry run mypy otterdog → clean
  • poetry run ruff check / ruff format --check → clean

Adds support for the 'prevent_self_review' setting on deployment
environments, which prevents the user who triggered a deployment from
approving it themselves when required reviewers are configured.

The field is a top-level boolean on the Environment API payload, so it
flows through the default from/to provider mappings without additional
transformation logic.

Changes:
- new 'prevent_self_review: bool' field on Environment model
- default value 'false' in the libsonnet template
- schema: new boolean property on environment.json
- tests updated to cover the new field
@netomi
Copy link
Copy Markdown
Member

netomi commented Apr 29, 2026

LGTM, can you add an entry to the CHANGELOG.md file?
It should also be documented in https://github.com/eclipse-csi/otterdog/blob/main/docs/reference/organization/repository/environment.md

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.

2 participants