Skip to content

Commit

Permalink
fix: find step by id instead of index (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMSchmidt authored Jan 24, 2024
1 parent dd9b2f2 commit cdc22ba
Show file tree
Hide file tree
Showing 7 changed files with 2,757 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .projen/deps.json

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

2 changes: 1 addition & 1 deletion .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const project = new cdk.JsiiProject({
pullRequestTemplate: false,
jsiiVersion: "~5.2.0",
typescriptVersion: "~5.2.0", // should always be the same major/minor as JSII
peerDeps: ["projen@^0.79.2", "constructs@^10.3.0"],
peerDeps: ["projen@^0.79.3", "constructs@^10.3.0"],
deps: ["change-case", "fs-extra"],
devDeps: ["@types/fs-extra", "glob"],
bundledDeps: ["change-case", "fs-extra"],
Expand Down
4 changes: 2 additions & 2 deletions package.json

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

15 changes: 8 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,17 +338,18 @@ export class CdktfProviderProject extends cdk.JsiiProject {
);

// ensure we don't fail if the release file is not present
// exit 0 if ./dist/dist/releasetag.txt is not present, otherwise exit 1
const oldRun: string = (this.release as any).defaultBranch.workflow.jobs
.release.steps[5].run;
const checkExistingTagStep = (
this.release as any
).defaultBranch.workflow.jobs.release.steps.find(
(s: object) => "id" in s && s.id === "check_tag_exists"
);
const oldExistingTagRun: string = checkExistingTagStep.run;
prettyAssertEqual(
oldRun.split("\n")[0],
oldExistingTagRun.split("\n")[0],
"TAG=$(cat dist/dist/releasetag.txt)",
"release step changed, please check if the workaround still works!"
);
(
this.release as any
).defaultBranch.workflow.jobs.release.steps[5].run = `if [ ! -f dist/dist/releasetag.txt ]; then (echo "exists=true" >> $GITHUB_OUTPUT) && exit 0; fi\n${oldRun}`;
checkExistingTagStep.run = `if [ ! -f dist/dist/releasetag.txt ]; then (echo "exists=true" >> $GITHUB_OUTPUT) && exit 0; fi\n${oldExistingTagRun}`;

if (!isDeprecated) {
const { upgrade, pr } = (this.upgradeWorkflow as any).workflows[0].jobs;
Expand Down
Loading

0 comments on commit cdc22ba

Please sign in to comment.