@codedrifters/configulator 0.0.323 → 0.0.324

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.mjs CHANGED
@@ -35287,6 +35287,22 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component21 {
35287
35287
  }
35288
35288
  ];
35289
35289
  };
35290
+ /**
35291
+ * Build the deterministic GitHub Actions job name for a deploy target.
35292
+ *
35293
+ * Used both to register the post-build job and as the sticky-PR-comment
35294
+ * header so dev/stage/prod comments don't collide on the same PR.
35295
+ */
35296
+ this.buildJobName = (target) => {
35297
+ return [
35298
+ target.awsStageType,
35299
+ target.deploymentTargetRole,
35300
+ "deploy",
35301
+ target.project.name,
35302
+ target.account,
35303
+ target.region
35304
+ ].join("-");
35305
+ };
35290
35306
  /**
35291
35307
  * Builds a GitHub Actions condition string that checks if the current branch
35292
35308
  * matches any of the provided branch patterns.
@@ -35326,6 +35342,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component21 {
35326
35342
  } = target;
35327
35343
  const { roleArn, stackPattern } = ciDeploymentConfig ?? {};
35328
35344
  const { rootCdkOut } = awsDeploymentConfig;
35345
+ const deployJobName = this.buildJobName(target);
35329
35346
  return [
35330
35347
  ...this.setupPnpm(),
35331
35348
  ...this.setupNode(),
@@ -35358,7 +35375,37 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component21 {
35358
35375
  ...awsDeploymentConfig.cdkCli.deployOptionsFor(target),
35359
35376
  app: rootCdkOut,
35360
35377
  stackPatterns: stackPattern ? [stackPattern] : void 0
35361
- })}`
35378
+ })} --outputs-file cdk-outputs.json`
35379
+ },
35380
+ /**
35381
+ * Render a job-summary table listing every `*Endpoint` output emitted
35382
+ * by the deploy. Also writes the same list to `deploy-urls.md` so the
35383
+ * follow-up sticky-PR-comment step can reuse it.
35384
+ */
35385
+ {
35386
+ name: "Render deploy summary",
35387
+ if: "hashFiles('cdk-outputs.json') != ''",
35388
+ shell: "bash",
35389
+ run: [
35390
+ 'echo "## Deployed endpoints" >> "$GITHUB_STEP_SUMMARY"',
35391
+ `jq -r '[.[] | to_entries[] | select(.key | test("Endpoint$")) | .value] | .[] | "- [\\(.)](\\(.))"' cdk-outputs.json | tee deploy-urls.md >> "$GITHUB_STEP_SUMMARY"`,
35392
+ 'echo "" >> "$GITHUB_STEP_SUMMARY"',
35393
+ 'echo "_DNS/CloudFront may take ~1 minute to propagate._" >> "$GITHUB_STEP_SUMMARY"'
35394
+ ].join("\n")
35395
+ },
35396
+ /**
35397
+ * Post a sticky PR comment listing each deployed endpoint. The
35398
+ * comment is keyed by the deploy job name so dev/stage/prod comments
35399
+ * don't collide on the same PR.
35400
+ */
35401
+ {
35402
+ name: "Sticky PR comment with deploy endpoints",
35403
+ if: "github.event_name == 'pull_request' && hashFiles('deploy-urls.md') != ''",
35404
+ uses: "marocchino/sticky-pull-request-comment@v2",
35405
+ with: {
35406
+ header: deployJobName,
35407
+ path: "deploy-urls.md"
35408
+ }
35362
35409
  }
35363
35410
  ];
35364
35411
  };
@@ -35453,18 +35500,8 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component21 {
35453
35500
  ...buildWorkflowOptions?.preBuildSteps ?? []
35454
35501
  ]
35455
35502
  });
35456
- const buildJobName = (target) => {
35457
- return [
35458
- target.awsStageType,
35459
- target.deploymentTargetRole,
35460
- "deploy",
35461
- target.project.name,
35462
- target.account,
35463
- target.region
35464
- ].join("-");
35465
- };
35466
35503
  this.awsDeploymentTargets.forEach((target) => {
35467
- const deployJobName = buildJobName(target);
35504
+ const deployJobName = this.buildJobName(target);
35468
35505
  const branchFilterCondition = this.buildBranchFilterCondition(
35469
35506
  target.branches
35470
35507
  );
@@ -35477,13 +35514,14 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component21 {
35477
35514
  needs: [
35478
35515
  "build",
35479
35516
  ...this.deployAfterTargets.map((p) => {
35480
- return buildJobName(p);
35517
+ return this.buildJobName(p);
35481
35518
  })
35482
35519
  ],
35483
35520
  runsOn: ["ubuntu-latest"],
35484
35521
  permissions: {
35485
35522
  contents: JobPermission5.READ,
35486
- idToken: JobPermission5.WRITE
35523
+ idToken: JobPermission5.WRITE,
35524
+ pullRequests: JobPermission5.WRITE
35487
35525
  },
35488
35526
  concurrency: deployJobName,
35489
35527
  if: jobCondition,