Skip to content

Commit 2d719f7

Browse files
author
Cliff Odijk
committed
Reduce remove reuse
1 parent aef22c4 commit 2d719f7

4 files changed

Lines changed: 26 additions & 26 deletions

File tree

dist/index.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/stage-processor.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export class AssemblyProcessor {
214214
} catch (e: any) {
215215
this.handleError(
216216
e,
217-
`Comment for stack ${stackName} is too long, please report this as a bug https://github.com/corymhall/cdk-diff-action/issues/new`,
217+
`Comment for directory ${this.options.cdkOutDir} is too long, please report this as a bug https://github.com/corymhall/cdk-diff-action/issues/new`,
218218
);
219219
}
220220
}
@@ -328,19 +328,19 @@ export class AssemblyProcessor {
328328
}
329329

330330
private formatStackComment(
331-
stackName: string,
331+
_stackName: string,
332332
diff: TemplateDiff,
333333
changes: ChangeDetails,
334334
): string[] {
335335
const output: string[] = [];
336336
const emoji = this.getEmoji(changes);
337337
if (diff.isEmpty) {
338-
output.push(`No Changes for stack: ${stackName} ${emoji}`);
338+
output.push(`No Changes for directory: ${this.options.cdkOutDir} ${emoji}`);
339339
return output;
340340
}
341341
output.push(
342342
...[
343-
`#### Diff for stack: ${stackName} - ` +
343+
`#### CDK Diff for ${this.options.cdkOutDir} - ` +
344344
`***${changes.createdResources} to add, ${changes.updatedResources} to update, ${changes.removedResources} to destroy*** ` +
345345
emoji,
346346
'<details><summary>Details</summary>',
@@ -352,7 +352,7 @@ export class AssemblyProcessor {
352352
output.push('> [!WARNING]\n> ***Destructive Changes*** :bangbang:'),
353353
changes.destructiveChanges.forEach((change) => {
354354
output.push(
355-
`> **Stack: ${change.stackName} - Resource: ${change.logicalId} - Impact:** ***${change.impact}***`,
355+
`> **Resource: ${change.logicalId} - Impact:** ***${change.impact}***`,
356356
);
357357
output.push('');
358358
});
@@ -370,12 +370,12 @@ export class AssemblyProcessor {
370370
}
371371

372372
/**
373-
* Only used when the stage comment is too long and we are creating
374-
* a separate comment for each stack
373+
* Only used when the comment is too long and we are creating
374+
* a separate comment for the directory
375375
*/
376376
private getCommentForStack(
377-
stageName: string,
378-
stackName: string,
377+
_stageName: string,
378+
_stackName: string,
379379
comment: string[],
380380
): string[] {
381381
const output: string[] = [];
@@ -386,7 +386,7 @@ export class AssemblyProcessor {
386386
output.push(`## ${this.options.title}`);
387387
output.push('');
388388
}
389-
output.push(`### Diff for stack: ${stageName} / ${stackName} (${this.options.cdkOutDir})`);
389+
output.push(`### CDK Diff for ${this.options.cdkOutDir}`);
390390

391391
return output.concat(comment);
392392
}
@@ -404,7 +404,7 @@ export class AssemblyProcessor {
404404
output.push(`## ${this.options.title}`);
405405
output.push('');
406406
}
407-
output.push(`### Diff for stage: ${stageName} (${this.options.cdkOutDir})`);
407+
output.push(`### CDK Diff for ${this.options.cdkOutDir}`);
408408

409409
if (stageComments.destructiveChanges) {
410410
output.push(

test/stage-processor.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ describe('StageProcessor', () => {
126126
SomeStage: expect.any(Object),
127127
});
128128
expect(p.SomeStage.stackComments['SomeStage/test-stack']).toEqual([
129-
'No Changes for stack: SomeStage/test-stack :white_check_mark:',
129+
'No Changes for directory: cdk.out :white_check_mark:',
130130
]);
131131
});
132132

@@ -330,7 +330,7 @@ describe('default stage', () => {
330330
DefaultStage: expect.any(Object),
331331
});
332332
expect(p.DefaultStage.stackComments['test-stack']).toEqual([
333-
'No Changes for stack: test-stack :white_check_mark:',
333+
'No Changes for directory: cdk.out :white_check_mark:',
334334
]);
335335
});
336336
});
@@ -432,7 +432,7 @@ describe('stack comments', () => {
432432
await processor.processStages();
433433
await expect(
434434
processor.commentStages(new Comments({} as any, {} as any)),
435-
).rejects.toThrow(/Comment for stack SomeStage\/my-stack1 is too long/);
435+
).rejects.toThrow(/Comment for directory cdk\.out is too long/);
436436
expect(findPreviousMock).toHaveBeenCalledTimes(11);
437437
expect(createCommentMock).toHaveBeenCalledTimes(0);
438438
expect(updateCommentMock).toHaveBeenCalledTimes(11);

0 commit comments

Comments
 (0)