-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
617 additions
and
371 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,22 +3,28 @@ import { Transform } from 'projen/lib/javascript'; | |
import { JsonPatch } from 'projen/lib/json-patch'; | ||
import { GitHubActionTypeScriptProject, RunsUsing } from 'projen-github-action-typescript'; | ||
const project = new GitHubActionTypeScriptProject({ | ||
majorVersion: 1, | ||
defaultReleaseBranch: 'main', | ||
authorEmail: '[email protected]', | ||
authorName: 'Cory Hall', | ||
name: 'cdk-diff-action', | ||
projenrcTs: true, | ||
actionMetadata: { | ||
author: 'Cory Hall', | ||
branding: { | ||
color: 'orange', | ||
icon: 'message-square', | ||
}, | ||
description: | ||
'The CDK Diff GitHub Action allows you to run CDK diff as part of your CI/CD workflow.', | ||
name: 'cdk-diff-action', | ||
inputs: { | ||
githubToken: { | ||
description: 'github token', | ||
required: true, | ||
}, | ||
allowedDestroyTypes: { | ||
description: 'Resource types that are allowed to be destroyed', | ||
description: 'Comma delimited list of resource types that are allowed to be destroyed', | ||
required: false, | ||
default: '', | ||
}, | ||
|
@@ -29,7 +35,7 @@ const project = new GitHubActionTypeScriptProject({ | |
}, | ||
}, | ||
runs: { | ||
using: RunsUsing.NODE_16, // overwrite to node18 | ||
using: RunsUsing.NODE_16, // overwrite to node20 | ||
main: 'dist/index.js', | ||
}, | ||
}, | ||
|
@@ -60,10 +66,6 @@ const project = new GitHubActionTypeScriptProject({ | |
configFilePath: 'jest.config.json', | ||
}, | ||
minNodeVersion: '18.12.0', | ||
|
||
// deps: [], /* Runtime dependencies of this module. */ | ||
// description: undefined, /* The description is just a string that helps people understand the purpose of the package. */ | ||
// packageName: undefined, /* The "name" in package.json. */ | ||
}); | ||
|
||
const projenProject = project as unknown as typescript.TypeScriptProject; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,59 @@ | ||
# replace this | ||
# CDK Diff Action | ||
|
||
GitHub action to comment on PRs with the stack diff. | ||
|
||
![](./diff-screenshot.png) | ||
|
||
## :sparkles: Features | ||
|
||
- :speech_balloon: Create a single comment per CDK stage | ||
- :recycle: Updates the same comment on each commit, reducing clutter | ||
- :bangbang: Calls out any destructive changes to resources | ||
- :x: Fail workflow if there are destructive changes | ||
- :thread: Summary of stack changes with expandable details | ||
- :see_no_evil: Allow destructive changes for certain resource types | ||
|
||
## Example Configurations | ||
|
||
The `cdk-diff-action` handles performing the diff and commenting on the PR. In | ||
order to do so it requires credentials to AWS and the synthesized CDK cloud | ||
assembly (cdk.out). Below is a minimal example | ||
|
||
```yml | ||
name: diff | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
Synth: | ||
name: Synthesize | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
- name: Synth | ||
run: npx cdk synth | ||
- name: Authenticate Via OIDC Role | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-region: us-east-2 | ||
role-duration-seconds: 1800 | ||
role-skip-session-tagging: true | ||
role-to-assume: arn:aws:iam::1234567891012:role/cdk_github_actions | ||
role-session-name: github | ||
- name: Diff | ||
uses: corymhall/cdk-diff-action@v1 | ||
with: | ||
githubToken: ${{ secrets.GITHUB_TOKEN }} | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.