Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions docs/src/content/docs/callback-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -471,16 +471,43 @@ ci:

## Environment Protection

Use GitHub environment protection for approval gates:
Use GitHub Environment protection for approval gates. Where you declare the
`environment:` key depends on whether the deploy is an external reusable
workflow or an inline `run:` callback, because GitHub Actions only allows a
job-level `environment:` key on a steps job, never on a job that calls a
reusable workflow with `uses:`.

### External reusable-workflow deploys (`workflow:`)

For a deploy backed by an external reusable workflow, declare `environment:` on
the job **inside your reusable workflow**. cascade passes the target environment
name to that workflow as the `environment` input, so wire it through:

```yaml
# your reusable deploy workflow
jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
environment: ${{ inputs.environment }} # protection lives here
steps:
- run: ./deploy.sh
```

Configure in GitHub: **Settings -> Environments -> Add required reviewers**.
cascade cannot set `environment:` on the caller job it generates: GitHub Actions
rejects a workflow that puts `environment:` on a `uses:` job. cascade therefore
emits only the `with: environment:` input on the caller and relies on your
reusable workflow to apply the protection rules. cascade prints a generate-time
note when `gha_environment` is configured for an environment whose deploys are
external reusable workflows, reminding you to declare `environment:` inside the
reusable workflow.

### Inline `run:` deploys

For an inline `run:` deploy, cascade owns the job and emits the job-level
`environment:` key directly (resolved from `gha_environment` when configured),
so GitHub Environment protection applies without any extra wiring.

Configure protection in GitHub: **Settings -> Environments -> Add required reviewers**.

## Dry Run Handling

Expand Down
9 changes: 8 additions & 1 deletion docs/src/content/docs/workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,11 @@ permissions:
packages: write # Optional: only if your callbacks publish to GHCR
```

For environment protection on deploys, set the environment in your callback:
For environment protection on an external reusable-workflow deploy, set the
`environment:` key on the job inside your callback. cascade passes the target
environment name as the `environment` input and cannot set `environment:` on the
caller job it generates, because GitHub Actions disallows that key on a `uses:`
job:

```yaml
jobs:
Expand All @@ -364,6 +368,9 @@ jobs:
environment: ${{ inputs.environment }} # GitHub enforces approvals
```

For an inline `run:` deploy, cascade owns the job and emits the job-level
`environment:` key for you when `gha_environment` is configured.

## Concurrency Control

Each workflow uses concurrency groups to prevent conflicts:
Expand Down
Loading
Loading