You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
environment: frontmatter field not propagated to safe_outputs job — breaks environment-level secrets #20378
environment: frontmatter field not propagated to safe_outputs job — breaks environment-level secrets
Describe the feature
When using the environment: frontmatter field, the compiler only applies it to the agent job in the compiled .lock.yml. The safe_outputs job does not receive the environment: field, which means any secrets scoped exclusively to GitHub deployment environments (e.g., dev, prod) are inaccessible in the safe_outputs job.
This is a problem when using GitHub App authentication via safe-outputs.app: with environment-level secrets, because the safe_outputs job generates the App token at runtime:
# In the compiled .lock.yml — safe_outputs job (NO environment: field)
- name: Generate GitHub App tokenid: safe-outputs-app-tokenuses: actions/create-github-app-token@v3with:
app-id: ${{ secrets.WORKFLOW_APP_ID }} # ← empty, no environment contextprivate-key: ${{ secrets.WORKFLOW_APP_PRIVATE_KEY }} # ← empty, no environment context
Expected behavior
The environment: frontmatter field should be propagated to all compiler-generated jobs that reference secrets, including safe_outputs, activation, conclusion, and any other jobs that use safe-outputs.app: or safe-outputs.github-token:.
Create a workflow with environment: in frontmatter and safe-outputs.app: referencing environment-level secrets
Compile with gh aw compile
Inspect the .lock.yml — only the agent job has the environment: field
The safe_outputs job references the same secrets but has no environment: context
Workaround
Store the GitHub App credentials (WORKFLOW_APP_ID, WORKFLOW_APP_PRIVATE_KEY) as repository-level secrets instead of environment-level secrets so they are accessible from all jobs regardless of environment: context.
Context
gh-aw version: v0.51.5 (also verified in v0.57.1 docs — no fix present)
Use case: CentralRepoOps pattern with environment-based dev/prod secret isolation
Impact: Any workflow using environment: with exclusively environment-scoped secrets will have its safe outputs silently fail (App token generation returns empty strings)
Activity
pelikhan commentedon Mar 10, 2026
@copilot add environment support in safe outputs with front matter field to allow overriding environment for safe outputs