@kungfu-tech/buildchain 2.14.18-alpha.11 → 2.14.18-alpha.3

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.
@@ -239,16 +239,6 @@ function main() {
239
239
  const deploymentBranches = environment !== "none" && environmentState.deployment_branch_policy?.custom_branch_policies === true
240
240
  ? githubJson(`repos/${repository}/environments/${encodeURIComponent(environment)}/deployment-branch-policies?per_page=100`, "Environment deployment branch policy")
241
241
  : { branch_policies: [] };
242
- const exactEnvironmentBranchPolicy = (deploymentBranches.branch_policies || []).find((entry) =>
243
- entry?.type === "branch" && entry?.name === branch
244
- );
245
- const environmentBranchAuthorized = environment !== "none" && (
246
- (
247
- environmentState.deployment_branch_policy?.protected_branches === true &&
248
- branchState.protected === true
249
- ) ||
250
- Boolean(exactEnvironmentBranchPolicy)
251
- );
252
242
  const oidc = githubJson(`repos/${repository}/actions/oidc/customization/sub`, "OIDC subject policy");
253
243
  if (!["npm-trusted-publisher", "github-token", "oidc-role"].includes(publisherMode)) {
254
244
  throw new Error(`unsupported --publisher-mode: ${publisherMode}`);
@@ -287,24 +277,10 @@ function main() {
287
277
  message: sourceMessage,
288
278
  changedPaths: sourceChangedPaths,
289
279
  };
290
- const branchHeadSha = String(branchState.commit?.sha || "").toLowerCase();
291
- const sourceComparison = sourceSha === branchHeadSha
292
- ? null
293
- : githubJson(
294
- `repos/${repository}/compare/${sourceSha}...${branchHeadSha}`,
295
- "source protected-branch lineage",
296
- );
297
- const sourceContainedInBranch = sourceSha === branchHeadSha || (
298
- sourceComparison?.status === "ahead" &&
299
- String(sourceComparison?.merge_base_commit?.sha || "").toLowerCase() === sourceSha
300
- );
301
280
  let pullRequests = githubJson(`repos/${repository}/commits/${authorizationSha}/pulls`, "source pull-request lineage");
302
281
  let mergedPullRequest = (Array.isArray(pullRequests) ? pullRequests : []).find((entry) =>
303
282
  entry?.merged_at &&
304
- (
305
- String(entry.merge_commit_sha || "").toLowerCase() === authorizationSha ||
306
- String(entry.head?.sha || "").toLowerCase() === authorizationSha
307
- ) &&
283
+ entry.merge_commit_sha === authorizationSha &&
308
284
  entry.base?.ref === branch &&
309
285
  entry.head?.repo?.full_name === repository
310
286
  );
@@ -342,12 +318,10 @@ function main() {
342
318
  const login = String(review?.user?.login || "");
343
319
  if (login) latestReviews.set(login, review);
344
320
  }
345
- const pullRequestHeadSha = String(mergedPullRequest?.head?.sha || "").toLowerCase();
346
321
  const independentApprovals = [...latestReviews.values()].filter((review) =>
347
- review.state === "APPROVED" &&
348
- review.user?.login !== mergedPullRequest?.user?.login &&
349
- String(review.commit_id || "").toLowerCase() === pullRequestHeadSha
322
+ review.state === "APPROVED" && review.user?.login !== mergedPullRequest?.user?.login
350
323
  );
324
+ const pullRequestHeadSha = String(mergedPullRequest?.head?.sha || "").toLowerCase();
351
325
  const checkRuns = /^[0-9a-f]{40}$/.test(pullRequestHeadSha)
352
326
  ? githubJson(`repos/${repository}/commits/${pullRequestHeadSha}/check-runs?per_page=100`, "merged pull-request head check runs")
353
327
  : { check_runs: [] };
@@ -386,8 +360,7 @@ function main() {
386
360
  requiredCheckSha: pullRequestHeadSha,
387
361
  sourceSha,
388
362
  authorizationSha,
389
- headSha: branchHeadSha,
390
- sourceContainedInBranch,
363
+ headSha: String(branchState.commit?.sha || "").toLowerCase(),
391
364
  releaseReconciliation,
392
365
  mergedPullRequest: Boolean(mergedPullRequest),
393
366
  pullRequestNumber: mergedPullRequest?.number || 0,
@@ -464,13 +437,6 @@ function main() {
464
437
  protected: (environmentState.protection_rules || []).length > 0 ||
465
438
  environmentState.deployment_branch_policy?.protected_branches === true ||
466
439
  (deploymentBranches.branch_policies || []).length > 0,
467
- branchAuthorized: environmentBranchAuthorized,
468
- branchPolicyMode: environmentState.deployment_branch_policy?.protected_branches === true
469
- ? "protected-branches"
470
- : exactEnvironmentBranchPolicy
471
- ? "exact-custom-branch"
472
- : "unqualified",
473
- authorizedBranch: exactEnvironmentBranchPolicy?.name || "",
474
440
  reviewRequired: reviewRules.length > 0,
475
441
  preventSelfReview: reviewRules.some((rule) => rule.prevent_self_review === true),
476
442
  },
@@ -209,7 +209,6 @@ permissions:
209
209
  contents: write
210
210
  id-token: write
211
211
  issues: write
212
- pull-requests: write
213
212
 
214
213
  jobs:
215
214
  resolve-promotion:
@@ -410,7 +409,6 @@ jobs:
410
409
  contents: write
411
410
  id-token: write
412
411
  issues: write
413
- pull-requests: write
414
412
  with:
415
413
  ${alphaForwarded}
416
414
  secrets: inherit
@@ -426,7 +424,6 @@ ${alphaForwarded}
426
424
  contents: write
427
425
  id-token: write
428
426
  issues: write
429
- pull-requests: write
430
427
  with:
431
428
  ${stableForwarded}
432
429
  secrets: inherit