Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the diff processing and assembly reading logic by migrating to the new toolkit‑lib API while updating tests and inputs accordingly. Key changes include:
- Introducing a FakeIoHost and modifying test cases to use toolkit‑lib imports.
- Renaming and refactoring the StageProcessor to AssemblyProcessor with updated diff handling.
- Updating inputs and configuration files (action.yml/.projenrc.ts) to align with new stack selector patterns and diff methods.
Reviewed Changes
Copilot reviewed 17 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/util.ts | Adds a FakeIoHost implementation with toolkit‑lib interfaces. |
| test/diff.test.ts | Updates tests to use toolkit‑lib diff and stack selection, removing legacy AWS SDK mocks. |
| test/assembly.test.ts | Adjusts manifest reader tests to work with CloudAssembly-based constructs. |
| src/stage-processor.ts | Renames StageProcessor to AssemblyProcessor and updates diff processing logic. |
| src/inputs.ts | Replaces noDiffForStages with stackSelectorPatterns and adds diffMethod. |
| src/diff.ts | Removes legacy credential/environment validation and switches to diff-based changes. |
| src/assembly.ts | Refactors AssemblyManifestReader to use CloudAssembly and filter stacks by diff presence. |
| src/action.ts | Updates action inputs and instantiates AssemblyProcessor with toolkit‑lib. |
| action.yml | Updates input definitions and defaults to support new diff method and stack selection. |
| .projenrc.ts | Updates configuration for new input patterns and adjusts packaging command. |
Files not reviewed (4)
- .projen/deps.json: Language not supported
- .projen/tasks.json: Language not supported
- package.json: Language not supported
- tsconfig.dev.json: Language not supported
Comments suppressed due to low confidence (2)
src/stage-processor.ts:137
- Consider verifying that the 'await using' syntax is supported in your target Node.js version and document its intended resource management behavior for clarity.
await using cloudAssembly = await assemblySource.produce();
.projenrc.ts:251
- [nitpick] Verify that 'src/index.ts' is intended as the main entry point for packaging, as the updated command differs from the previous configuration.
projenProject.packageTask.exec('cp node_modules/@aws-cdk/aws-service-spec/db.json.gz ./ && ncc build src/index.ts --source-map --transpile-only --license licenses.txt');
| cdkOutDir: getInput('cdkOutDir', { required: true }), | ||
| diffMethod: getInput('diffMethod', { required: true }), | ||
| }; | ||
|
|
There was a problem hiding this comment.
[nitpick] Add a code comment explaining why the stackSelectionStrategy is forcibly set to 'pattern-must-match' when stackSelectorPatterns are provided to clarify the design intent.
Suggested change
| // If stackSelectorPatterns are provided, the stackSelectionStrategy must be set to 'pattern-must-match' | |
| // to ensure that only stacks matching the specified patterns are selected. This overrides the default | |
| // 'all-stacks' strategy to prevent unintended behavior. |
64c3251 to
3bcaa22
Compare
Signed-off-by: github-actions <github-actions@github.com>
corymhall
added a commit
that referenced
this pull request
Jun 20, 2025
This PR refactors the diff and assembly processing to use the new `@aws-cdk/toolkit-lib` library. This allows us to greatly simplify the logic that we have to maintain and offload more work to the core library. For example, this allows us to use the default CDK authentication instead of trying to replicate it ourselves (see #62). Couple of other changes that I've included in this PR since v2 allows me a chance to make breaking changes. BREAKING CHANGE: several breaking changes with details below There are several breaking changes in this release. 1. Replace `noDiffForStages` with `stackSelectionStrategy` & `stackSelectorPatterns` This uses the native selection stack filtering capability of `toolkit-lib` and should be a more robust option for users to filter stacks. `stackSelectorPatterns` also uses a multi-line input instead of a comma delimited string input. To migrate from `noDiffForStages` to `stackSelectorPatterns` you can do this: ```yaml - name: Diff uses: corymhall/cdk-diff-action@v1 with: noDiffForStages: "Stage1,Stage2" githubToken: ${{ secrets.GITHUB_TOKEN }} - name: Diff uses: corymhall/cdk-diff-action@v2-beta with: stackSelectorPatterns: | !Stage1/* !Stage2/* githubToken: ${{ secrets.GITHUB_TOKEN }} ``` 2. The default `diffMethod` is changed to `change-set` to match the cdk default behavior. This also changes the IAM Role used for diff from the `lookup-role` to the `deploy-role`. To keep the old behavior you can specify `diffMethod: template-only` 3. `allowDestroyTypes` and `noFailOnDestructiveChanges` input types were changed from a comma delimited string to a multi-line string. ```yaml - name: Diff uses: corymhall/cdk-diff-action@v1 with: noFailOnDestructiveChanges: "Stage1,Stage2" githubToken: ${{ secrets.GITHUB_TOKEN }} - name: Diff uses: corymhall/cdk-diff-action@v2-beta with: noFailOnDestructiveChanges: | Stage1 Stage2 githubToken: ${{ secrets.GITHUB_TOKEN }} ``` Closes #44 Fixes #62 --------- Signed-off-by: github-actions <github-actions@github.com> Co-authored-by: github-actions <github-actions@github.com>
corymhall
added a commit
that referenced
this pull request
Jun 20, 2025
This PR refactors the diff and assembly processing to use the new `@aws-cdk/toolkit-lib` library. This allows us to greatly simplify the logic that we have to maintain and offload more work to the core library. For example, this allows us to use the default CDK authentication instead of trying to replicate it ourselves (see #62). Couple of other changes that I've included in this PR since v2 allows me a chance to make breaking changes. BREAKING CHANGE: several breaking changes with details below There are several breaking changes in this release. 1. Replace `noDiffForStages` with `stackSelectionStrategy` & `stackSelectorPatterns` This uses the native selection stack filtering capability of `toolkit-lib` and should be a more robust option for users to filter stacks. `stackSelectorPatterns` also uses a multi-line input instead of a comma delimited string input. To migrate from `noDiffForStages` to `stackSelectorPatterns` you can do this: ```yaml # from this - name: Diff uses: corymhall/cdk-diff-action@v1 with: noDiffForStages: "Stage1,Stage2" githubToken: ${{ secrets.GITHUB_TOKEN }} # to this - name: Diff uses: corymhall/cdk-diff-action@v2-beta with: stackSelectorPatterns: | !Stage1/* !Stage2/* githubToken: ${{ secrets.GITHUB_TOKEN }} ``` 2. The default `diffMethod` is changed to `change-set` to match the cdk default behavior. This also changes the IAM Role used for diff from the `lookup-role` to the `deploy-role`. To keep the old behavior you can specify `diffMethod: template-only` 3. `allowDestroyTypes` and `noFailOnDestructiveChanges` input types were changed from a comma delimited string to a multi-line string. ```yaml # from this - name: Diff uses: corymhall/cdk-diff-action@v1 with: noFailOnDestructiveChanges: "Stage1,Stage2" githubToken: ${{ secrets.GITHUB_TOKEN }} # to this - name: Diff uses: corymhall/cdk-diff-action@v2-beta with: noFailOnDestructiveChanges: | Stage1 Stage2 githubToken: ${{ secrets.GITHUB_TOKEN }} ``` Closes #44 Fixes #62 --------- Signed-off-by: github-actions <github-actions@github.com> Co-authored-by: github-actions <github-actions@github.com>Fixes #
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR refactors the diff and assembly processing to use the new
@aws-cdk/toolkit-liblibrary.This allows us to greatly simplify the logic that we have to maintain and offload more work to the core library.
For example, this allows us to use the default CDK authentication instead of trying to replicate it ourselves (see #62).
Couple of other changes that I've included in this PR since v2 allows me a chance to make breaking changes.
BREAKING CHANGE: several breaking changes with details below
There are several breaking changes in this release.
noDiffForStageswithstackSelectionStrategy&stackSelectorPatternsThis uses the native selection stack filtering capability of
toolkit-liband should be a more robust option for users to filter stacks.stackSelectorPatternsalso uses a multi-line input instead of a comma delimited string input. To migrate fromnoDiffForStagestostackSelectorPatternsyou can do this:diffMethodis changed tochange-setto match the cdk default behavior. This also changes the IAM Role used for diff from thelookup-roleto thedeploy-role. To keep the old behavior you can specifydiffMethod: template-onlyallowDestroyTypesandnoFailOnDestructiveChangesinput types were changed from a comma delimited string to a multi-line string.Closes #44
Fixes #62