@codedrifters/configulator 0.0.125 → 0.0.127

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.d.mts CHANGED
@@ -399,10 +399,17 @@ declare const VERSION: {
399
399
  * What version of the turborepo library should we use?
400
400
  */
401
401
  readonly TURBO_VERSION: "2.8.14";
402
+ /**
403
+ * What version of Vite to use (pnpm override). Pinned to 5.x so Vitest 4.x
404
+ * can load config (Vite 6+/7+ are ESM-only; see issue #142). Remove override
405
+ * when moving to ESM-only test setup.
406
+ */
407
+ readonly VITE_VERSION: "5.4.11";
402
408
  /**
403
409
  * What version of Vitest to use when testRunner is 'vitest'.
410
+ * Pinned to 3.x so it works with Vite 5 (Vitest 4 requires Vite 6). See issue #142.
404
411
  */
405
- readonly VITEST_VERSION: "4.0.18";
412
+ readonly VITEST_VERSION: "3.2.4";
406
413
  };
407
414
 
408
415
  /**
@@ -421,8 +428,9 @@ declare const VERSION_NPM_PACKAGES: ReadonlyArray<{
421
428
  npmPackage: string;
422
429
  }>;
423
430
  /**
424
- * VERSION keys that are not backed by npm and must be skipped by
425
- * auto-update (e.g. runtime versions like Node.js).
431
+ * VERSION keys that are not backed by npm or must be skipped by
432
+ * auto-update (e.g. runtime versions like Node.js, or pinned deps like
433
+ * VITE_VERSION until ESM-only test setup).
426
434
  */
427
435
  declare const VERSION_KEYS_SKIP: ReadonlyArray<VersionKey>;
428
436
 
@@ -1176,6 +1184,71 @@ declare class TurboRepo extends Component$1 {
1176
1184
  preSynthesize(): void;
1177
1185
  }
1178
1186
 
1187
+ /** Merge methods supported by enable-pull-request-automerge. */
1188
+ declare const MERGE_METHODS: {
1189
+ readonly SQUASH: "squash";
1190
+ readonly MERGE: "merge";
1191
+ readonly REBASE: "rebase";
1192
+ };
1193
+ /** Merge method for the approve-and-merge-upgrade workflow. */
1194
+ type MergeMethod = (typeof MERGE_METHODS)[keyof typeof MERGE_METHODS];
1195
+ /**
1196
+ * Options for the approve-and-merge-upgrade workflow (ADR 0001 §2).
1197
+ * When set, adds a workflow that approves and merges the dependency-upgrade PR
1198
+ * when it has the auto-approve label and head branch matches. Trigger types
1199
+ * exclude `opened` to prevent double approval when the PR is created with the label.
1200
+ */
1201
+ interface ApproveMergeUpgradeOptions {
1202
+ /**
1203
+ * Workflow file name (display name in Actions tab).
1204
+ * @default "approve-and-merge-upgrade"
1205
+ */
1206
+ readonly workflowName?: string;
1207
+ /**
1208
+ * Label that must be present on the PR to trigger approve-and-merge.
1209
+ * @default "auto-approve"
1210
+ */
1211
+ readonly autoApproveLabel?: string;
1212
+ /**
1213
+ * Head branch name the PR must target (e.g. the branch created by the upgrade workflow).
1214
+ * @default "github-actions/upgrade"
1215
+ */
1216
+ readonly headBranch?: string;
1217
+ /**
1218
+ * GitHub usernames allowed as PR authors (e.g. automation bot logins).
1219
+ * The workflow runs only when the PR user is in this list.
1220
+ */
1221
+ readonly allowedUsernames: string[];
1222
+ /**
1223
+ * Repository secret name for the approval GitHub App ID.
1224
+ * @default "APPROVAL_APP_ID"
1225
+ */
1226
+ readonly approvalAppIdSecret?: string;
1227
+ /**
1228
+ * Repository secret name for the approval GitHub App private key (PEM).
1229
+ * @default "APPROVAL_APP_PRIVATE_KEY"
1230
+ */
1231
+ readonly approvalAppPrivateKeySecret?: string;
1232
+ /**
1233
+ * Merge method for enable-pull-request-automerge.
1234
+ * @default "squash"
1235
+ */
1236
+ readonly mergeMethod?: MergeMethod;
1237
+ /**
1238
+ * Optional branch filters for pull_request_target (e.g. base branches).
1239
+ * @see https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target
1240
+ */
1241
+ readonly branches?: string[];
1242
+ }
1243
+ /**
1244
+ * Adds the approve-and-merge-upgrade workflow to the project.
1245
+ * Uses a GitHub App token for approve + enable automerge (squash by default).
1246
+ *
1247
+ * @param project - A NodeProject with GitHub (e.g. MonorepoProject)
1248
+ * @param options - Options for the workflow; allowedUsernames is required
1249
+ */
1250
+ declare function addApproveMergeUpgradeWorkflow(project: NodeProject, options: ApproveMergeUpgradeOptions): void;
1251
+
1179
1252
  /*******************************************************************************
1180
1253
  *
1181
1254
  * Monorepo Root Project
@@ -1243,6 +1316,15 @@ interface MonorepoProjectOptions extends Omit<TypeScriptProjectOptions$1, "defau
1243
1316
  * @default: daily schedule
1244
1317
  */
1245
1318
  readonly upgradeConfigulatorTaskOptions?: UpgradeDependenciesOptions;
1319
+ /**
1320
+ * When set, adds the approve-and-merge-upgrade workflow (ADR 0001 §2).
1321
+ * Uses a second GitHub App to approve and merge the dependency-upgrade PR
1322
+ * when it has the auto-approve label and head branch matches. Trigger types
1323
+ * exclude `opened` to prevent double approval.
1324
+ *
1325
+ * @see ApproveMergeUpgradeOptions
1326
+ */
1327
+ readonly approveMergeUpgradeOptions?: ApproveMergeUpgradeOptions;
1246
1328
  }
1247
1329
  declare class MonorepoProject extends TypeScriptAppProject {
1248
1330
  /**
@@ -1504,4 +1586,17 @@ declare class AwsDeployWorkflow extends Component {
1504
1586
  preSynthesize(): void;
1505
1587
  }
1506
1588
 
1507
- export { type AwsAccount, AwsDeployWorkflow, AwsDeploymentConfig, AwsDeploymentTarget, type AwsDeploymentTargetOptions, type AwsLocalDeploymentConfig, type AwsOrganization, type AwsRegion, type CiDeploymentConfig, type ClassTypeOptions, type DeployWorkflowOptions, type GitBranch, type IDependencyResolver, JsiiFaker, MIMIMUM_RELEASE_AGE, MonorepoProject, type MonorepoProjectOptions, PROD_DEPLOY_NAME, PnpmWorkspace, type PnpmWorkspaceOptions, ROOT_CI_TASK_NAME, ROOT_TURBO_TASK_NAME, type RemoteCacheOptions, ResetTask, type ResetTaskOptions, TestRunner, TurboRepo, type TurboRepoOptions, TurboRepoTask, type TurboRepoTaskOptions, TypeScriptConfig, TypeScriptProject, type TypeScriptProjectOptions, VERSION, VERSION_KEYS_SKIP, VERSION_NPM_PACKAGES, VSCodeConfig, type VersionKey, Vitest, type VitestConfigOptions, type VitestOptions, getLatestEligibleVersion };
1589
+ /** Name of the gate job appended to build workflows (ADR 0004). */
1590
+ declare const COMPLETE_JOB_ID = "complete";
1591
+ /**
1592
+ * Appends the "complete" gate job to a build workflow (ADR 0004, issue #165).
1593
+ * The job runs after all other jobs, uses {@code if: always()}, and succeeds
1594
+ * only when the build job succeeded and every other job succeeded or was skipped.
1595
+ * Call this for the default build workflow and for any build workflow created
1596
+ * by Configulator (e.g. AwsDeployWorkflow).
1597
+ *
1598
+ * @param buildWorkflow The Projen BuildWorkflow to append the complete job to.
1599
+ */
1600
+ declare function addBuildCompleteJob(buildWorkflow: BuildWorkflow): void;
1601
+
1602
+ export { type ApproveMergeUpgradeOptions, type AwsAccount, AwsDeployWorkflow, AwsDeploymentConfig, AwsDeploymentTarget, type AwsDeploymentTargetOptions, type AwsLocalDeploymentConfig, type AwsOrganization, type AwsRegion, COMPLETE_JOB_ID, type CiDeploymentConfig, type ClassTypeOptions, type DeployWorkflowOptions, type GitBranch, type IDependencyResolver, JsiiFaker, MERGE_METHODS, MIMIMUM_RELEASE_AGE, type MergeMethod, MonorepoProject, type MonorepoProjectOptions, PROD_DEPLOY_NAME, PnpmWorkspace, type PnpmWorkspaceOptions, ROOT_CI_TASK_NAME, ROOT_TURBO_TASK_NAME, type RemoteCacheOptions, ResetTask, type ResetTaskOptions, TestRunner, TurboRepo, type TurboRepoOptions, TurboRepoTask, type TurboRepoTaskOptions, TypeScriptConfig, TypeScriptProject, type TypeScriptProjectOptions, VERSION, VERSION_KEYS_SKIP, VERSION_NPM_PACKAGES, VSCodeConfig, type VersionKey, Vitest, type VitestConfigOptions, type VitestOptions, addApproveMergeUpgradeWorkflow, addBuildCompleteJob, getLatestEligibleVersion };
package/lib/index.d.ts CHANGED
@@ -448,10 +448,17 @@ declare const VERSION: {
448
448
  * What version of the turborepo library should we use?
449
449
  */
450
450
  readonly TURBO_VERSION: "2.8.14";
451
+ /**
452
+ * What version of Vite to use (pnpm override). Pinned to 5.x so Vitest 4.x
453
+ * can load config (Vite 6+/7+ are ESM-only; see issue #142). Remove override
454
+ * when moving to ESM-only test setup.
455
+ */
456
+ readonly VITE_VERSION: "5.4.11";
451
457
  /**
452
458
  * What version of Vitest to use when testRunner is 'vitest'.
459
+ * Pinned to 3.x so it works with Vite 5 (Vitest 4 requires Vite 6). See issue #142.
453
460
  */
454
- readonly VITEST_VERSION: "4.0.18";
461
+ readonly VITEST_VERSION: "3.2.4";
455
462
  };
456
463
 
457
464
  /**
@@ -470,8 +477,9 @@ declare const VERSION_NPM_PACKAGES: ReadonlyArray<{
470
477
  npmPackage: string;
471
478
  }>;
472
479
  /**
473
- * VERSION keys that are not backed by npm and must be skipped by
474
- * auto-update (e.g. runtime versions like Node.js).
480
+ * VERSION keys that are not backed by npm or must be skipped by
481
+ * auto-update (e.g. runtime versions like Node.js, or pinned deps like
482
+ * VITE_VERSION until ESM-only test setup).
475
483
  */
476
484
  declare const VERSION_KEYS_SKIP: ReadonlyArray<VersionKey>;
477
485
 
@@ -1225,6 +1233,71 @@ declare class TurboRepo extends Component$1 {
1225
1233
  preSynthesize(): void;
1226
1234
  }
1227
1235
 
1236
+ /** Merge methods supported by enable-pull-request-automerge. */
1237
+ declare const MERGE_METHODS: {
1238
+ readonly SQUASH: "squash";
1239
+ readonly MERGE: "merge";
1240
+ readonly REBASE: "rebase";
1241
+ };
1242
+ /** Merge method for the approve-and-merge-upgrade workflow. */
1243
+ type MergeMethod = (typeof MERGE_METHODS)[keyof typeof MERGE_METHODS];
1244
+ /**
1245
+ * Options for the approve-and-merge-upgrade workflow (ADR 0001 §2).
1246
+ * When set, adds a workflow that approves and merges the dependency-upgrade PR
1247
+ * when it has the auto-approve label and head branch matches. Trigger types
1248
+ * exclude `opened` to prevent double approval when the PR is created with the label.
1249
+ */
1250
+ interface ApproveMergeUpgradeOptions {
1251
+ /**
1252
+ * Workflow file name (display name in Actions tab).
1253
+ * @default "approve-and-merge-upgrade"
1254
+ */
1255
+ readonly workflowName?: string;
1256
+ /**
1257
+ * Label that must be present on the PR to trigger approve-and-merge.
1258
+ * @default "auto-approve"
1259
+ */
1260
+ readonly autoApproveLabel?: string;
1261
+ /**
1262
+ * Head branch name the PR must target (e.g. the branch created by the upgrade workflow).
1263
+ * @default "github-actions/upgrade"
1264
+ */
1265
+ readonly headBranch?: string;
1266
+ /**
1267
+ * GitHub usernames allowed as PR authors (e.g. automation bot logins).
1268
+ * The workflow runs only when the PR user is in this list.
1269
+ */
1270
+ readonly allowedUsernames: string[];
1271
+ /**
1272
+ * Repository secret name for the approval GitHub App ID.
1273
+ * @default "APPROVAL_APP_ID"
1274
+ */
1275
+ readonly approvalAppIdSecret?: string;
1276
+ /**
1277
+ * Repository secret name for the approval GitHub App private key (PEM).
1278
+ * @default "APPROVAL_APP_PRIVATE_KEY"
1279
+ */
1280
+ readonly approvalAppPrivateKeySecret?: string;
1281
+ /**
1282
+ * Merge method for enable-pull-request-automerge.
1283
+ * @default "squash"
1284
+ */
1285
+ readonly mergeMethod?: MergeMethod;
1286
+ /**
1287
+ * Optional branch filters for pull_request_target (e.g. base branches).
1288
+ * @see https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target
1289
+ */
1290
+ readonly branches?: string[];
1291
+ }
1292
+ /**
1293
+ * Adds the approve-and-merge-upgrade workflow to the project.
1294
+ * Uses a GitHub App token for approve + enable automerge (squash by default).
1295
+ *
1296
+ * @param project - A NodeProject with GitHub (e.g. MonorepoProject)
1297
+ * @param options - Options for the workflow; allowedUsernames is required
1298
+ */
1299
+ declare function addApproveMergeUpgradeWorkflow(project: NodeProject, options: ApproveMergeUpgradeOptions): void;
1300
+
1228
1301
  /*******************************************************************************
1229
1302
  *
1230
1303
  * Monorepo Root Project
@@ -1292,6 +1365,15 @@ interface MonorepoProjectOptions extends Omit<TypeScriptProjectOptions$1, "defau
1292
1365
  * @default: daily schedule
1293
1366
  */
1294
1367
  readonly upgradeConfigulatorTaskOptions?: UpgradeDependenciesOptions;
1368
+ /**
1369
+ * When set, adds the approve-and-merge-upgrade workflow (ADR 0001 §2).
1370
+ * Uses a second GitHub App to approve and merge the dependency-upgrade PR
1371
+ * when it has the auto-approve label and head branch matches. Trigger types
1372
+ * exclude `opened` to prevent double approval.
1373
+ *
1374
+ * @see ApproveMergeUpgradeOptions
1375
+ */
1376
+ readonly approveMergeUpgradeOptions?: ApproveMergeUpgradeOptions;
1295
1377
  }
1296
1378
  declare class MonorepoProject extends TypeScriptAppProject {
1297
1379
  /**
@@ -1553,5 +1635,18 @@ declare class AwsDeployWorkflow extends Component {
1553
1635
  preSynthesize(): void;
1554
1636
  }
1555
1637
 
1556
- export { AwsDeployWorkflow, AwsDeploymentConfig, AwsDeploymentTarget, JsiiFaker, MIMIMUM_RELEASE_AGE, MonorepoProject, PROD_DEPLOY_NAME, PnpmWorkspace, ROOT_CI_TASK_NAME, ROOT_TURBO_TASK_NAME, ResetTask, TestRunner, TurboRepo, TurboRepoTask, TypeScriptConfig, TypeScriptProject, VERSION, VERSION_KEYS_SKIP, VERSION_NPM_PACKAGES, VSCodeConfig, Vitest, getLatestEligibleVersion };
1557
- export type { AwsAccount, AwsDeploymentTargetOptions, AwsLocalDeploymentConfig, AwsOrganization, AwsRegion, CiDeploymentConfig, ClassTypeOptions, DeployWorkflowOptions, GitBranch, IDependencyResolver, MonorepoProjectOptions, PnpmWorkspaceOptions, RemoteCacheOptions, ResetTaskOptions, TurboRepoOptions, TurboRepoTaskOptions, TypeScriptProjectOptions, VersionKey, VitestConfigOptions, VitestOptions };
1638
+ /** Name of the gate job appended to build workflows (ADR 0004). */
1639
+ declare const COMPLETE_JOB_ID = "complete";
1640
+ /**
1641
+ * Appends the "complete" gate job to a build workflow (ADR 0004, issue #165).
1642
+ * The job runs after all other jobs, uses {@code if: always()}, and succeeds
1643
+ * only when the build job succeeded and every other job succeeded or was skipped.
1644
+ * Call this for the default build workflow and for any build workflow created
1645
+ * by Configulator (e.g. AwsDeployWorkflow).
1646
+ *
1647
+ * @param buildWorkflow The Projen BuildWorkflow to append the complete job to.
1648
+ */
1649
+ declare function addBuildCompleteJob(buildWorkflow: BuildWorkflow): void;
1650
+
1651
+ export { AwsDeployWorkflow, AwsDeploymentConfig, AwsDeploymentTarget, COMPLETE_JOB_ID, JsiiFaker, MERGE_METHODS, MIMIMUM_RELEASE_AGE, MonorepoProject, PROD_DEPLOY_NAME, PnpmWorkspace, ROOT_CI_TASK_NAME, ROOT_TURBO_TASK_NAME, ResetTask, TestRunner, TurboRepo, TurboRepoTask, TypeScriptConfig, TypeScriptProject, VERSION, VERSION_KEYS_SKIP, VERSION_NPM_PACKAGES, VSCodeConfig, Vitest, addApproveMergeUpgradeWorkflow, addBuildCompleteJob, getLatestEligibleVersion };
1652
+ export type { ApproveMergeUpgradeOptions, AwsAccount, AwsDeploymentTargetOptions, AwsLocalDeploymentConfig, AwsOrganization, AwsRegion, CiDeploymentConfig, ClassTypeOptions, DeployWorkflowOptions, GitBranch, IDependencyResolver, MergeMethod, MonorepoProjectOptions, PnpmWorkspaceOptions, RemoteCacheOptions, ResetTaskOptions, TurboRepoOptions, TurboRepoTaskOptions, TypeScriptProjectOptions, VersionKey, VitestConfigOptions, VitestOptions };
package/lib/index.js CHANGED
@@ -178,7 +178,9 @@ __export(index_exports, {
178
178
  AwsDeployWorkflow: () => AwsDeployWorkflow,
179
179
  AwsDeploymentConfig: () => AwsDeploymentConfig,
180
180
  AwsDeploymentTarget: () => AwsDeploymentTarget,
181
+ COMPLETE_JOB_ID: () => COMPLETE_JOB_ID,
181
182
  JsiiFaker: () => JsiiFaker,
183
+ MERGE_METHODS: () => MERGE_METHODS,
182
184
  MIMIMUM_RELEASE_AGE: () => MIMIMUM_RELEASE_AGE,
183
185
  MonorepoProject: () => MonorepoProject,
184
186
  PROD_DEPLOY_NAME: () => PROD_DEPLOY_NAME,
@@ -196,6 +198,8 @@ __export(index_exports, {
196
198
  VERSION_NPM_PACKAGES: () => VERSION_NPM_PACKAGES,
197
199
  VSCodeConfig: () => VSCodeConfig,
198
200
  Vitest: () => Vitest,
201
+ addApproveMergeUpgradeWorkflow: () => addApproveMergeUpgradeWorkflow,
202
+ addBuildCompleteJob: () => addBuildCompleteJob,
199
203
  getLatestEligibleVersion: () => getLatestEligibleVersion
200
204
  });
201
205
  module.exports = __toCommonJS(index_exports);
@@ -779,7 +783,12 @@ var VERSION_NPM_PACKAGES = [
779
783
  { key: "TURBO_VERSION", npmPackage: "turbo" },
780
784
  { key: "VITEST_VERSION", npmPackage: "vitest" }
781
785
  ];
782
- var VERSION_KEYS_SKIP = ["NODE_WORKFLOWS"];
786
+ var VERSION_KEYS_SKIP = [
787
+ "NODE_WORKFLOWS",
788
+ "VITE_VERSION",
789
+ "VITEST_VERSION"
790
+ // Pinned to 3.x for Vite 5 compatibility; skip until ESM-only (issue #142)
791
+ ];
783
792
 
784
793
  // src/versions.ts
785
794
  var VERSION = {
@@ -815,10 +824,17 @@ var VERSION = {
815
824
  * What version of the turborepo library should we use?
816
825
  */
817
826
  TURBO_VERSION: "2.8.14",
827
+ /**
828
+ * What version of Vite to use (pnpm override). Pinned to 5.x so Vitest 4.x
829
+ * can load config (Vite 6+/7+ are ESM-only; see issue #142). Remove override
830
+ * when moving to ESM-only test setup.
831
+ */
832
+ VITE_VERSION: "5.4.11",
818
833
  /**
819
834
  * What version of Vitest to use when testRunner is 'vitest'.
835
+ * Pinned to 3.x so it works with Vite 5 (Vitest 4 requires Vite 6). See issue #142.
820
836
  */
821
- VITEST_VERSION: "4.0.18"
837
+ VITEST_VERSION: "3.2.4"
822
838
  };
823
839
 
824
840
  // src/jsii/jsii-faker.ts
@@ -1313,6 +1329,133 @@ var VSCodeConfig = class extends import_projen8.Component {
1313
1329
  }
1314
1330
  };
1315
1331
 
1332
+ // src/workflows/approve-merge-upgrade.ts
1333
+ var import_workflows_model2 = require("projen/lib/github/workflows-model");
1334
+ var MERGE_METHODS = {
1335
+ SQUASH: "squash",
1336
+ MERGE: "merge",
1337
+ REBASE: "rebase"
1338
+ };
1339
+ var DEFAULT_WORKFLOW_NAME = "approve-and-merge-upgrade";
1340
+ var DEFAULT_AUTO_APPROVE_LABEL = "auto-approve";
1341
+ var DEFAULT_HEAD_BRANCH = "github-actions/upgrade";
1342
+ var DEFAULT_APPROVAL_APP_ID_SECRET = "APPROVAL_APP_ID";
1343
+ var DEFAULT_APPROVAL_APP_PRIVATE_KEY_SECRET = "APPROVAL_APP_PRIVATE_KEY";
1344
+ var DEFAULT_MERGE_METHOD = MERGE_METHODS.SQUASH;
1345
+ var PULL_REQUEST_TARGET_TYPES = [
1346
+ "labeled",
1347
+ "synchronize",
1348
+ "reopened",
1349
+ "ready_for_review"
1350
+ ];
1351
+ function addApproveMergeUpgradeWorkflow(project, options) {
1352
+ const workflowName = options.workflowName ?? DEFAULT_WORKFLOW_NAME;
1353
+ const autoApproveLabel = options.autoApproveLabel ?? DEFAULT_AUTO_APPROVE_LABEL;
1354
+ const headBranch = options.headBranch ?? DEFAULT_HEAD_BRANCH;
1355
+ const allowedUsernames = options.allowedUsernames;
1356
+ const appIdSecret = options.approvalAppIdSecret ?? DEFAULT_APPROVAL_APP_ID_SECRET;
1357
+ const privateKeySecret = options.approvalAppPrivateKeySecret ?? DEFAULT_APPROVAL_APP_PRIVATE_KEY_SECRET;
1358
+ const mergeMethod = options.mergeMethod ?? DEFAULT_MERGE_METHOD;
1359
+ const workflow = project.github?.addWorkflow(workflowName);
1360
+ if (!workflow) return;
1361
+ workflow.on({
1362
+ pullRequestTarget: {
1363
+ types: [...PULL_REQUEST_TARGET_TYPES],
1364
+ ...options.branches && options.branches.length > 0 ? { branches: options.branches } : {}
1365
+ }
1366
+ });
1367
+ const jobCondition = [
1368
+ `contains(github.event.pull_request.labels.*.name, '${autoApproveLabel}')`,
1369
+ `github.event.pull_request.head.ref == '${headBranch}'`,
1370
+ `(${allowedUsernames.map((u) => `github.event.pull_request.user.login == '${u}'`).join(" || ")})`
1371
+ ].join(" && ");
1372
+ workflow.addJobs({
1373
+ "approve-and-merge": {
1374
+ name: "Approve and merge upgrade PR",
1375
+ runsOn: ["ubuntu-latest"],
1376
+ permissions: {
1377
+ pullRequests: import_workflows_model2.JobPermission.WRITE,
1378
+ contents: import_workflows_model2.JobPermission.WRITE
1379
+ },
1380
+ if: jobCondition,
1381
+ steps: [
1382
+ {
1383
+ name: "Generate token",
1384
+ id: "generate_token",
1385
+ uses: "actions/create-github-app-token@v2",
1386
+ with: {
1387
+ "app-id": `\${{ secrets.${appIdSecret} }}`,
1388
+ "private-key": `\${{ secrets.${privateKeySecret} }}`
1389
+ }
1390
+ },
1391
+ {
1392
+ name: "Auto-approve",
1393
+ uses: "hmarr/auto-approve-action@f0939ea97e9205ef24d872e76833fa908a770363",
1394
+ with: {
1395
+ "github-token": "${{ steps.generate_token.outputs.token }}"
1396
+ }
1397
+ },
1398
+ {
1399
+ name: "Enable auto-merge (squash)",
1400
+ uses: "peter-evans/enable-pull-request-automerge@v3",
1401
+ with: {
1402
+ token: "${{ steps.generate_token.outputs.token }}",
1403
+ "pull-request-number": "${{ github.event.pull_request.number }}",
1404
+ "merge-method": mergeMethod
1405
+ }
1406
+ }
1407
+ ]
1408
+ }
1409
+ });
1410
+ }
1411
+
1412
+ // src/workflows/build-complete-job.ts
1413
+ var import_workflows_model3 = require("projen/lib/github/workflows-model");
1414
+ var BUILD_JOB_ID = "build";
1415
+ var COMPLETE_JOB_ID = "complete";
1416
+ function buildCompleteJobRunScript(jobIds) {
1417
+ const lines = [];
1418
+ for (const id of jobIds) {
1419
+ const expr = "${{ needs." + id + ".result }}";
1420
+ if (id === BUILD_JOB_ID) {
1421
+ lines.push(
1422
+ `if [ "${expr}" != "success" ]; then echo "Job ${id} must succeed"; exit 1; fi`
1423
+ );
1424
+ } else {
1425
+ lines.push(
1426
+ `if [ "${expr}" != "success" ] && [ "${expr}" != "skipped" ]; then echo "Job ${id} must succeed or be skipped"; exit 1; fi`
1427
+ );
1428
+ }
1429
+ }
1430
+ return lines.join("\n");
1431
+ }
1432
+ function addBuildCompleteJob(buildWorkflow) {
1433
+ const w = buildWorkflow.workflow;
1434
+ if (!w?.jobs || typeof w.addJob !== "function") {
1435
+ return;
1436
+ }
1437
+ const jobIds = Object.keys(w.jobs).filter((id) => id !== COMPLETE_JOB_ID);
1438
+ if (jobIds.length === 0) {
1439
+ return;
1440
+ }
1441
+ const runScript = buildCompleteJobRunScript(jobIds);
1442
+ w.addJob(COMPLETE_JOB_ID, {
1443
+ name: "Complete",
1444
+ needs: jobIds,
1445
+ if: "always()",
1446
+ runsOn: ["ubuntu-latest"],
1447
+ permissions: {
1448
+ contents: import_workflows_model3.JobPermission.NONE
1449
+ },
1450
+ steps: [
1451
+ {
1452
+ name: "Verify all jobs succeeded or were skipped",
1453
+ run: runScript
1454
+ }
1455
+ ]
1456
+ });
1457
+ }
1458
+
1316
1459
  // src/projects/monorepo-project.ts
1317
1460
  var postInstallDependenciesMap = /* @__PURE__ */ new WeakMap();
1318
1461
  var MonorepoProject = class extends import_typescript.TypeScriptAppProject {
@@ -1547,6 +1690,12 @@ var MonorepoProject = class extends import_typescript.TypeScriptAppProject {
1547
1690
  )
1548
1691
  );
1549
1692
  }
1693
+ if (options.approveMergeUpgradeOptions) {
1694
+ addApproveMergeUpgradeWorkflow(this, options.approveMergeUpgradeOptions);
1695
+ }
1696
+ if (this.buildWorkflow) {
1697
+ addBuildCompleteJob(this.buildWorkflow);
1698
+ }
1550
1699
  this.tasks.tryFind("post-upgrade")?.exec("pnpm upgrade -r");
1551
1700
  this.tasks.tryFind("post-upgrade")?.spawn(this.defaultTask);
1552
1701
  }
@@ -1613,7 +1762,7 @@ var import_utils3 = __toESM(require_lib());
1613
1762
  var import_projen10 = require("projen");
1614
1763
  var import_build = require("projen/lib/build");
1615
1764
  var import_github = require("projen/lib/github");
1616
- var import_workflows_model2 = require("projen/lib/github/workflows-model");
1765
+ var import_workflows_model4 = require("projen/lib/github/workflows-model");
1617
1766
  var PROD_DEPLOY_NAME = "prod-deploy";
1618
1767
  var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen10.Component {
1619
1768
  constructor(project, options = {}) {
@@ -1842,14 +1991,15 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen10.Compone
1842
1991
  ],
1843
1992
  runsOn: ["ubuntu-latest"],
1844
1993
  permissions: {
1845
- contents: import_workflows_model2.JobPermission.READ,
1846
- idToken: import_workflows_model2.JobPermission.WRITE
1994
+ contents: import_workflows_model4.JobPermission.READ,
1995
+ idToken: import_workflows_model4.JobPermission.WRITE
1847
1996
  },
1848
1997
  concurrency: deployJobName,
1849
1998
  if: jobCondition,
1850
1999
  steps: [...this.deploySteps(target)]
1851
2000
  });
1852
2001
  });
2002
+ addBuildCompleteJob(this.buildWorkflow);
1853
2003
  }
1854
2004
  static of(project, buildWorkflow) {
1855
2005
  const isDefined = (c) => c instanceof _AwsDeployWorkflow && c.buildWorkflow === buildWorkflow;
@@ -1882,7 +2032,9 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen10.Compone
1882
2032
  AwsDeployWorkflow,
1883
2033
  AwsDeploymentConfig,
1884
2034
  AwsDeploymentTarget,
2035
+ COMPLETE_JOB_ID,
1885
2036
  JsiiFaker,
2037
+ MERGE_METHODS,
1886
2038
  MIMIMUM_RELEASE_AGE,
1887
2039
  MonorepoProject,
1888
2040
  PROD_DEPLOY_NAME,
@@ -1900,6 +2052,8 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen10.Compone
1900
2052
  VERSION_NPM_PACKAGES,
1901
2053
  VSCodeConfig,
1902
2054
  Vitest,
2055
+ addApproveMergeUpgradeWorkflow,
2056
+ addBuildCompleteJob,
1903
2057
  getLatestEligibleVersion
1904
2058
  });
1905
2059
  //# sourceMappingURL=index.js.map