@databricks-solutions/lakebase-scm-utils 0.2.46 → 0.2.47

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.
Files changed (62) hide show
  1. package/dist/{pr-D3CteJaf.d.cts → pr-e-E4aP4j.d.cts} +6 -0
  2. package/dist/{pr-D3CteJaf.d.ts → pr-e-E4aP4j.d.ts} +6 -0
  3. package/dist/scripts/github/index.cjs +2 -0
  4. package/dist/scripts/github/index.d.cts +1 -1
  5. package/dist/scripts/github/index.d.ts +1 -1
  6. package/dist/scripts/github/index.js +2 -0
  7. package/dist/scripts/github/pr.cli.cjs +2 -0
  8. package/dist/scripts/github/pr.cli.js +2 -0
  9. package/dist/scripts/index.cjs +28 -4
  10. package/dist/scripts/index.d.cts +2 -2
  11. package/dist/scripts/index.d.ts +2 -2
  12. package/dist/scripts/index.js +26 -4
  13. package/dist/scripts/lakebase/ci-resolve-branch.cli.cjs +2 -2
  14. package/dist/scripts/lakebase/ci-resolve-branch.cli.js +2 -2
  15. package/dist/scripts/lakebase/collapse-heads.cli.cjs +2 -2
  16. package/dist/scripts/lakebase/collapse-heads.cli.js +2 -2
  17. package/dist/scripts/lakebase/detect-language.cli.cjs +2 -2
  18. package/dist/scripts/lakebase/detect-language.cli.js +2 -2
  19. package/dist/scripts/lakebase/doctor.cli.cjs +2 -2
  20. package/dist/scripts/lakebase/doctor.cli.js +2 -2
  21. package/dist/scripts/lakebase/get-connection.cli.cjs +2 -2
  22. package/dist/scripts/lakebase/get-connection.cli.js +2 -2
  23. package/dist/scripts/lakebase/index.cjs +34 -4
  24. package/dist/scripts/lakebase/index.d.cts +3 -3
  25. package/dist/scripts/lakebase/index.d.ts +3 -3
  26. package/dist/scripts/lakebase/index.js +34 -4
  27. package/dist/scripts/lakebase/infra-runner.cli.cjs +2 -2
  28. package/dist/scripts/lakebase/infra-runner.cli.js +2 -2
  29. package/dist/scripts/lakebase/new-migration.cli.cjs +2 -2
  30. package/dist/scripts/lakebase/new-migration.cli.js +2 -2
  31. package/dist/scripts/lakebase/schema-diff.cli.cjs +2 -2
  32. package/dist/scripts/lakebase/schema-diff.cli.js +2 -2
  33. package/dist/scripts/lakebase/schema-migrate.cli.cjs +2 -2
  34. package/dist/scripts/lakebase/schema-migrate.cli.js +2 -2
  35. package/dist/scripts/lakebase/scm-claim-feature.cli.cjs +2 -2
  36. package/dist/scripts/lakebase/scm-claim-feature.cli.js +2 -2
  37. package/dist/scripts/lakebase/scm-doctor.cli.cjs +2 -2
  38. package/dist/scripts/lakebase/scm-doctor.cli.js +2 -2
  39. package/dist/scripts/lakebase/scm-merge.cli.cjs +2 -2
  40. package/dist/scripts/lakebase/scm-merge.cli.js +2 -2
  41. package/dist/scripts/lakebase/scm-prepare-pr.cli.cjs +2 -0
  42. package/dist/scripts/lakebase/scm-prepare-pr.cli.js +2 -0
  43. package/dist/scripts/lakebase/scm-reconcile-tier.cli.cjs +2 -2
  44. package/dist/scripts/lakebase/scm-reconcile-tier.cli.js +2 -2
  45. package/dist/scripts/lakebase/scm-wait-ci.cli.cjs +8 -0
  46. package/dist/scripts/lakebase/scm-wait-ci.cli.js +8 -0
  47. package/dist/scripts/lakebase/sync-ci-secrets.cli.cjs +8610 -0
  48. package/dist/scripts/lakebase/sync-ci-secrets.cli.d.cts +4 -0
  49. package/dist/scripts/lakebase/sync-ci-secrets.cli.d.ts +4 -0
  50. package/dist/scripts/lakebase/sync-ci-secrets.cli.js +8597 -0
  51. package/dist/scripts/util/index.cjs +21 -2
  52. package/dist/scripts/util/index.d.cts +9 -1
  53. package/dist/scripts/util/index.d.ts +9 -1
  54. package/dist/scripts/util/index.js +19 -2
  55. package/package.json +3 -2
  56. package/scripts/github/pr.ts +8 -0
  57. package/scripts/lakebase/create-project.ts +14 -3
  58. package/scripts/lakebase/scm-wait-ci.ts +13 -0
  59. package/scripts/lakebase/sync-ci-secrets.cli.ts +122 -0
  60. package/scripts/util/ci-secrets.ts +14 -1
  61. package/templates/project/common/.gitignore.base +6 -0
  62. package/templates/project/common/scripts/lk +22 -4
@@ -2518,8 +2518,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
2518
2518
  var cached;
2519
2519
  function substrateSelfVersion() {
2520
2520
  if (cached !== void 0) return cached;
2521
- if ("0.2.46".length > 0) {
2522
- cached = "0.2.46";
2521
+ if ("0.2.47".length > 0) {
2522
+ cached = "0.2.47";
2523
2523
  return cached;
2524
2524
  }
2525
2525
  cached = "unknown";
@@ -10674,6 +10674,8 @@ async function getPullRequest(ownerRepo, headBranch) {
10674
10674
  isDraft: pr.draft || false,
10675
10675
  ciStatus,
10676
10676
  checks,
10677
+ mergeable: pr.mergeable,
10678
+ mergeableState: pr.mergeable_state,
10677
10679
  headBranch: pr.head?.ref || headBranch,
10678
10680
  baseBranch: pr.base?.ref || "",
10679
10681
  body: pr.body || void 0,
@@ -12922,6 +12924,16 @@ async function setRepoSecrets(ownerRepo, secrets) {
12922
12924
  await setRepoSecret(ownerRepo, name, value);
12923
12925
  }
12924
12926
  }
12927
+ async function listSecretNames(ownerRepo) {
12928
+ try {
12929
+ const { owner, repo } = parseOwnerRepo(ownerRepo);
12930
+ const octokit2 = await getOctokit2();
12931
+ const { data } = await octokit2.rest.actions.listRepoSecrets({ owner, repo });
12932
+ return data.secrets.map((s) => s.name);
12933
+ } catch {
12934
+ return [];
12935
+ }
12936
+ }
12925
12937
 
12926
12938
  // scripts/git/remote.ts
12927
12939
  init_esm_shims();
@@ -12961,6 +12973,11 @@ async function getOwnerRepo(cwd) {
12961
12973
  }
12962
12974
 
12963
12975
  // scripts/util/ci-secrets.ts
12976
+ var REQUIRED_CI_SECRETS = ["DATABRICKS_HOST", "LAKEBASE_PROJECT_ID", "DATABRICKS_TOKEN"];
12977
+ async function missingCiSecrets(ownerRepo) {
12978
+ const present = new Set(await listSecretNames(ownerRepo));
12979
+ return REQUIRED_CI_SECRETS.filter((n) => !present.has(n));
12980
+ }
12964
12981
  async function syncCiSecrets(args) {
12965
12982
  const lifetime = args.lifetimeSeconds ?? 86400;
12966
12983
  const comment = args.comment ?? "GitHub Actions CI";
@@ -13477,10 +13494,17 @@ Last probe error:
13477
13494
  lifetimeSeconds: 86400,
13478
13495
  ownerRepo: fullRepoName
13479
13496
  });
13497
+ const missing = await missingCiSecrets(fullRepoName);
13498
+ if (missing.length > 0) {
13499
+ const m = `CI auth incomplete \u2014 repo secret(s) MISSING: ${missing.join(", ")}. CI cannot provision a per-PR Lakebase branch until fixed. Repair with: lakebase-sync-ci-secrets (run in the project).`;
13500
+ warnings.push(m);
13501
+ report(`WARNING: ${m}`);
13502
+ }
13480
13503
  } catch (err) {
13481
13504
  const msg = err instanceof Error ? err.message : String(err);
13482
- warnings.push(`CI auth setup failed: ${msg}`);
13483
- report(`Warning: CI auth setup failed (${msg})`);
13505
+ const m = `CI auth setup failed: ${msg}. CI will fail (no DATABASE_URL) until repaired \u2014 run: lakebase-sync-ci-secrets (in the project).`;
13506
+ warnings.push(m);
13507
+ report(`WARNING: ${m}`);
13484
13508
  }
13485
13509
  }
13486
13510
  if (useGithub && runnerType === "self-hosted") {
@@ -15832,6 +15856,12 @@ async function waitForCi(args) {
15832
15856
  if (lastPr.ciStatus === "success") {
15833
15857
  return { done: true, value: lastPr };
15834
15858
  }
15859
+ if (lastPr.mergeableState === "dirty" && lastPr.checks.length === 0) {
15860
+ throw new ScmWaitCiError(
15861
+ `PR ${lastPr.url} is CONFLICTING with ${lastPr.baseBranch} \u2014 GitHub will not dispatch CI (0 runs) until the conflict is resolved. Reconcile the branch and re-push; the synchronize event will trigger CI.`,
15862
+ "pr-conflicting"
15863
+ );
15864
+ }
15835
15865
  if (lastPr.ciStatus === "failure") {
15836
15866
  const failed = lastPr.checks.filter((c) => /(FAILURE|TIMED_OUT|CANCELLED|ACTION_REQUIRED)/i.test(c.conclusion)).map((c) => `${c.name} (${c.conclusion})`);
15837
15867
  throw new ScmWaitCiError(
@@ -79290,8 +79290,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
79290
79290
  var cached;
79291
79291
  function substrateSelfVersion() {
79292
79292
  if (cached !== void 0) return cached;
79293
- if ("0.2.46".length > 0) {
79294
- cached = "0.2.46";
79293
+ if ("0.2.47".length > 0) {
79294
+ cached = "0.2.47";
79295
79295
  return cached;
79296
79296
  }
79297
79297
  cached = "unknown";
@@ -393,8 +393,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
393
393
  var cached;
394
394
  function substrateSelfVersion() {
395
395
  if (cached !== void 0) return cached;
396
- if ("0.2.46".length > 0) {
397
- cached = "0.2.46";
396
+ if ("0.2.47".length > 0) {
397
+ cached = "0.2.47";
398
398
  return cached;
399
399
  }
400
400
  cached = "unknown";
@@ -79290,8 +79290,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
79290
79290
  var cached;
79291
79291
  function substrateSelfVersion() {
79292
79292
  if (cached !== void 0) return cached;
79293
- if ("0.2.46".length > 0) {
79294
- cached = "0.2.46";
79293
+ if ("0.2.47".length > 0) {
79294
+ cached = "0.2.47";
79295
79295
  return cached;
79296
79296
  }
79297
79297
  cached = "unknown";
@@ -393,8 +393,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
393
393
  var cached;
394
394
  function substrateSelfVersion() {
395
395
  if (cached !== void 0) return cached;
396
- if ("0.2.46".length > 0) {
397
- cached = "0.2.46";
396
+ if ("0.2.47".length > 0) {
397
+ cached = "0.2.47";
398
398
  return cached;
399
399
  }
400
400
  cached = "unknown";
@@ -79288,8 +79288,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
79288
79288
  var cached;
79289
79289
  function substrateSelfVersion() {
79290
79290
  if (cached !== void 0) return cached;
79291
- if ("0.2.46".length > 0) {
79292
- cached = "0.2.46";
79291
+ if ("0.2.47".length > 0) {
79292
+ cached = "0.2.47";
79293
79293
  return cached;
79294
79294
  }
79295
79295
  cached = "unknown";
@@ -389,8 +389,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
389
389
  var cached;
390
390
  function substrateSelfVersion() {
391
391
  if (cached !== void 0) return cached;
392
- if ("0.2.46".length > 0) {
393
- cached = "0.2.46";
392
+ if ("0.2.47".length > 0) {
393
+ cached = "0.2.47";
394
394
  return cached;
395
395
  }
396
396
  cached = "unknown";
@@ -79324,8 +79324,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
79324
79324
  var cached;
79325
79325
  function substrateSelfVersion() {
79326
79326
  if (cached !== void 0) return cached;
79327
- if ("0.2.46".length > 0) {
79328
- cached = "0.2.46";
79327
+ if ("0.2.47".length > 0) {
79328
+ cached = "0.2.47";
79329
79329
  return cached;
79330
79330
  }
79331
79331
  cached = "unknown";
@@ -427,8 +427,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
427
427
  var cached;
428
428
  function substrateSelfVersion() {
429
429
  if (cached !== void 0) return cached;
430
- if ("0.2.46".length > 0) {
431
- cached = "0.2.46";
430
+ if ("0.2.47".length > 0) {
431
+ cached = "0.2.47";
432
432
  return cached;
433
433
  }
434
434
  cached = "unknown";
@@ -79783,8 +79783,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
79783
79783
  var cached;
79784
79784
  function substrateSelfVersion() {
79785
79785
  if (cached !== void 0) return cached;
79786
- if ("0.2.46".length > 0) {
79787
- cached = "0.2.46";
79786
+ if ("0.2.47".length > 0) {
79787
+ cached = "0.2.47";
79788
79788
  return cached;
79789
79789
  }
79790
79790
  cached = "unknown";
@@ -864,8 +864,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
864
864
  var cached;
865
865
  function substrateSelfVersion() {
866
866
  if (cached !== void 0) return cached;
867
- if ("0.2.46".length > 0) {
868
- cached = "0.2.46";
867
+ if ("0.2.47".length > 0) {
868
+ cached = "0.2.47";
869
869
  return cached;
870
870
  }
871
871
  cached = "unknown";
@@ -88240,8 +88240,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
88240
88240
  var cached;
88241
88241
  function substrateSelfVersion() {
88242
88242
  if (cached !== void 0) return cached;
88243
- if ("0.2.46".length > 0) {
88244
- cached = "0.2.46";
88243
+ if ("0.2.47".length > 0) {
88244
+ cached = "0.2.47";
88245
88245
  return cached;
88246
88246
  }
88247
88247
  cached = "unknown";
@@ -9393,8 +9393,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
9393
9393
  var cached;
9394
9394
  function substrateSelfVersion() {
9395
9395
  if (cached !== void 0) return cached;
9396
- if ("0.2.46".length > 0) {
9397
- cached = "0.2.46";
9396
+ if ("0.2.47".length > 0) {
9397
+ cached = "0.2.47";
9398
9398
  return cached;
9399
9399
  }
9400
9400
  cached = "unknown";
@@ -88474,8 +88474,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
88474
88474
  var cached;
88475
88475
  function substrateSelfVersion() {
88476
88476
  if (cached !== void 0) return cached;
88477
- if ("0.2.46".length > 0) {
88478
- cached = "0.2.46";
88477
+ if ("0.2.47".length > 0) {
88478
+ cached = "0.2.47";
88479
88479
  return cached;
88480
88480
  }
88481
88481
  cached = "unknown";
@@ -9627,8 +9627,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
9627
9627
  var cached;
9628
9628
  function substrateSelfVersion() {
9629
9629
  if (cached !== void 0) return cached;
9630
- if ("0.2.46".length > 0) {
9631
- cached = "0.2.46";
9630
+ if ("0.2.47".length > 0) {
9631
+ cached = "0.2.47";
9632
9632
  return cached;
9633
9633
  }
9634
9634
  cached = "unknown";
@@ -8393,6 +8393,8 @@ async function getPullRequest(ownerRepo, headBranch) {
8393
8393
  isDraft: pr.draft || false,
8394
8394
  ciStatus,
8395
8395
  checks,
8396
+ mergeable: pr.mergeable,
8397
+ mergeableState: pr.mergeable_state,
8396
8398
  headBranch: pr.head?.ref || headBranch,
8397
8399
  baseBranch: pr.base?.ref || "",
8398
8400
  body: pr.body || void 0,
@@ -8381,6 +8381,8 @@ async function getPullRequest(ownerRepo, headBranch) {
8381
8381
  isDraft: pr.draft || false,
8382
8382
  ciStatus,
8383
8383
  checks,
8384
+ mergeable: pr.mergeable,
8385
+ mergeableState: pr.mergeable_state,
8384
8386
  headBranch: pr.head?.ref || headBranch,
8385
8387
  baseBranch: pr.base?.ref || "",
8386
8388
  body: pr.body || void 0,
@@ -79288,8 +79288,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
79288
79288
  var cached;
79289
79289
  function substrateSelfVersion() {
79290
79290
  if (cached !== void 0) return cached;
79291
- if ("0.2.46".length > 0) {
79292
- cached = "0.2.46";
79291
+ if ("0.2.47".length > 0) {
79292
+ cached = "0.2.47";
79293
79293
  return cached;
79294
79294
  }
79295
79295
  cached = "unknown";
@@ -389,8 +389,8 @@ var PKG_NAME = "@databricks-solutions/lakebase-scm-utils";
389
389
  var cached;
390
390
  function substrateSelfVersion() {
391
391
  if (cached !== void 0) return cached;
392
- if ("0.2.46".length > 0) {
393
- cached = "0.2.46";
392
+ if ("0.2.47".length > 0) {
393
+ cached = "0.2.47";
394
394
  return cached;
395
395
  }
396
396
  cached = "unknown";
@@ -8235,6 +8235,8 @@ async function getPullRequest(ownerRepo, headBranch) {
8235
8235
  isDraft: pr.draft || false,
8236
8236
  ciStatus,
8237
8237
  checks,
8238
+ mergeable: pr.mergeable,
8239
+ mergeableState: pr.mergeable_state,
8238
8240
  headBranch: pr.head?.ref || headBranch,
8239
8241
  baseBranch: pr.base?.ref || "",
8240
8242
  body: pr.body || void 0,
@@ -8662,6 +8664,12 @@ async function waitForCi(args) {
8662
8664
  if (lastPr.ciStatus === "success") {
8663
8665
  return { done: true, value: lastPr };
8664
8666
  }
8667
+ if (lastPr.mergeableState === "dirty" && lastPr.checks.length === 0) {
8668
+ throw new ScmWaitCiError(
8669
+ `PR ${lastPr.url} is CONFLICTING with ${lastPr.baseBranch} \u2014 GitHub will not dispatch CI (0 runs) until the conflict is resolved. Reconcile the branch and re-push; the synchronize event will trigger CI.`,
8670
+ "pr-conflicting"
8671
+ );
8672
+ }
8665
8673
  if (lastPr.ciStatus === "failure") {
8666
8674
  const failed = lastPr.checks.filter((c) => /(FAILURE|TIMED_OUT|CANCELLED|ACTION_REQUIRED)/i.test(c.conclusion)).map((c) => `${c.name} (${c.conclusion})`);
8667
8675
  throw new ScmWaitCiError(
@@ -8223,6 +8223,8 @@ async function getPullRequest(ownerRepo, headBranch) {
8223
8223
  isDraft: pr.draft || false,
8224
8224
  ciStatus,
8225
8225
  checks,
8226
+ mergeable: pr.mergeable,
8227
+ mergeableState: pr.mergeable_state,
8226
8228
  headBranch: pr.head?.ref || headBranch,
8227
8229
  baseBranch: pr.base?.ref || "",
8228
8230
  body: pr.body || void 0,
@@ -8650,6 +8652,12 @@ async function waitForCi(args) {
8650
8652
  if (lastPr.ciStatus === "success") {
8651
8653
  return { done: true, value: lastPr };
8652
8654
  }
8655
+ if (lastPr.mergeableState === "dirty" && lastPr.checks.length === 0) {
8656
+ throw new ScmWaitCiError(
8657
+ `PR ${lastPr.url} is CONFLICTING with ${lastPr.baseBranch} \u2014 GitHub will not dispatch CI (0 runs) until the conflict is resolved. Reconcile the branch and re-push; the synchronize event will trigger CI.`,
8658
+ "pr-conflicting"
8659
+ );
8660
+ }
8653
8661
  if (lastPr.ciStatus === "failure") {
8654
8662
  const failed = lastPr.checks.filter((c) => /(FAILURE|TIMED_OUT|CANCELLED|ACTION_REQUIRED)/i.test(c.conclusion)).map((c) => `${c.name} (${c.conclusion})`);
8655
8663
  throw new ScmWaitCiError(