Skip to content

Commit

Permalink
fix: Add the environment attribute to workflow yml file conditionally (
Browse files Browse the repository at this point in the history
…#186)

Based on discussion #178 (comment)

Removes `environment: null` from workflows that did not specify the environment.
  • Loading branch information
julianiag authored Apr 29, 2022
1 parent 71346e6 commit 0e29c2b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,9 @@ export class GitHubWorkflow extends PipelineBase {
contents: github.JobPermission.READ,
idToken: this.useGitHubActionRole ? github.JobPermission.WRITE : github.JobPermission.NONE,
},
environment: this.stackEnvs[stack.stackArtifactId],
...(this.stackEnvs[stack.stackArtifactId] ? {
environment: this.stackEnvs[stack.stackArtifactId],
} : {}),
needs: this.renderDependencies(node),
runsOn: this.runner.runsOn,
steps: [
Expand Down
7 changes: 0 additions & 7 deletions test/__snapshots__/github.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0e29c2b

Please sign in to comment.