@intentius/chant 0.124.91 → 0.124.93

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 (108) hide show
  1. package/dist/__golden__/notify-defaults-plain.json +52 -0
  2. package/dist/__golden__/notify-defaults-relay.json +92 -0
  3. package/dist/ci-comment-commands.d.ts +11 -1
  4. package/dist/ci-comment-commands.d.ts.map +1 -1
  5. package/dist/ci-comment-commands.js +10 -3
  6. package/dist/ci-job-guard.d.ts +22 -8
  7. package/dist/ci-job-guard.d.ts.map +1 -1
  8. package/dist/ci-job-guard.js +93 -49
  9. package/dist/ci-jobs.d.ts +22 -0
  10. package/dist/ci-jobs.d.ts.map +1 -1
  11. package/dist/ci-jobs.js +23 -0
  12. package/dist/ci-product.d.ts +42 -1
  13. package/dist/ci-product.d.ts.map +1 -1
  14. package/dist/ci-product.js +44 -3
  15. package/dist/cli/handlers/pr-comment.d.ts.map +1 -1
  16. package/dist/cli/handlers/pr-comment.js +15 -2
  17. package/dist/cli/handlers/pr.d.ts.map +1 -1
  18. package/dist/cli/handlers/pr.js +4 -1
  19. package/dist/components/pr-pipeline.d.ts +4 -2
  20. package/dist/components/pr-pipeline.d.ts.map +1 -1
  21. package/dist/components/pr-pipeline.js +7 -4
  22. package/dist/components/product-pipeline.d.ts +71 -7
  23. package/dist/components/product-pipeline.d.ts.map +1 -1
  24. package/dist/components/product-pipeline.js +84 -22
  25. package/dist/components/product-plan.d.ts +7 -0
  26. package/dist/components/product-plan.d.ts.map +1 -1
  27. package/dist/components/product-plan.js +1 -0
  28. package/dist/floor-table.data.d.ts.map +1 -1
  29. package/dist/floor-table.data.js +15 -5
  30. package/dist/lexicon.d.ts +59 -1
  31. package/dist/lexicon.d.ts.map +1 -1
  32. package/dist/notify.d.ts +8 -0
  33. package/dist/notify.d.ts.map +1 -1
  34. package/dist/notify.js +8 -3
  35. package/dist/op/before-merge-decide.d.ts +2 -0
  36. package/dist/op/before-merge-decide.d.ts.map +1 -1
  37. package/dist/op/before-merge.d.ts +8 -0
  38. package/dist/op/before-merge.d.ts.map +1 -1
  39. package/dist/op/before-merge.js +6 -0
  40. package/dist/op/index.d.ts +1 -1
  41. package/dist/op/index.d.ts.map +1 -1
  42. package/dist/op/index.js +1 -1
  43. package/dist/op/op-waves-evidence-jobs.d.ts +3 -2
  44. package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -1
  45. package/dist/op/op-waves-evidence-jobs.js +4 -3
  46. package/dist/op/op-waves-follow-on.d.ts +2 -0
  47. package/dist/op/op-waves-follow-on.d.ts.map +1 -1
  48. package/dist/op/op-waves-follow-on.js +8 -2
  49. package/dist/op/op-waves-names.d.ts +145 -0
  50. package/dist/op/op-waves-names.d.ts.map +1 -0
  51. package/dist/op/op-waves-names.js +201 -0
  52. package/dist/op/op-waves-run.d.ts +2 -0
  53. package/dist/op/op-waves-run.d.ts.map +1 -1
  54. package/dist/op/op-waves-run.js +2 -2
  55. package/dist/op/op-waves-stand-down.d.ts +9 -1
  56. package/dist/op/op-waves-stand-down.d.ts.map +1 -1
  57. package/dist/op/op-waves-stand-down.js +14 -2
  58. package/dist/op/op-waves.d.ts +12 -1
  59. package/dist/op/op-waves.d.ts.map +1 -1
  60. package/dist/op/op-waves.js +2 -0
  61. package/dist/pr-forge-job.d.ts +8 -0
  62. package/dist/pr-forge-job.d.ts.map +1 -1
  63. package/dist/pr-forge-job.js +13 -0
  64. package/dist/pr-plan-record.d.ts +3 -1
  65. package/dist/pr-plan-record.d.ts.map +1 -1
  66. package/dist/pr-plan-record.js +1 -1
  67. package/dist/pr-post.d.ts +9 -3
  68. package/dist/pr-post.d.ts.map +1 -1
  69. package/dist/pr-post.js +5 -2
  70. package/dist/release-floors.d.ts +1 -1
  71. package/dist/release-floors.d.ts.map +1 -1
  72. package/dist/release-floors.js +4 -4
  73. package/dist/wave-runtime.mjs +305 -305
  74. package/package.json +1 -1
  75. package/src/__golden__/notify-defaults-plain.json +52 -0
  76. package/src/__golden__/notify-defaults-relay.json +92 -0
  77. package/src/ci-comment-commands.test.ts +19 -5
  78. package/src/ci-comment-commands.ts +18 -3
  79. package/src/ci-job-guard.default-branch.test.ts +125 -0
  80. package/src/ci-job-guard.ts +64 -10
  81. package/src/ci-jobs.ts +26 -0
  82. package/src/ci-product.ts +54 -3
  83. package/src/cli/handlers/pr-comment.ts +12 -2
  84. package/src/cli/handlers/pr.ts +4 -1
  85. package/src/components/pr-pipeline.ts +7 -4
  86. package/src/components/product-job-names.test.ts +176 -0
  87. package/src/components/product-pipeline.ts +143 -31
  88. package/src/components/product-plan.ts +8 -0
  89. package/src/floor-table.data.ts +15 -5
  90. package/src/lexicon.ts +59 -1
  91. package/src/notify-bundle.test.ts +3 -2
  92. package/src/notify-relay-name.test.ts +72 -0
  93. package/src/notify.ts +16 -3
  94. package/src/op/before-merge-decide.ts +2 -0
  95. package/src/op/before-merge.ts +12 -0
  96. package/src/op/index.ts +1 -1
  97. package/src/op/op-waves-evidence-jobs.ts +4 -3
  98. package/src/op/op-waves-follow-on.ts +10 -2
  99. package/src/op/op-waves-names.test.ts +131 -0
  100. package/src/op/op-waves-names.ts +289 -0
  101. package/src/op/op-waves-run.ts +4 -2
  102. package/src/op/op-waves-stand-down.ts +15 -2
  103. package/src/op/op-waves.ts +13 -1
  104. package/src/pr-forge-job.ts +13 -0
  105. package/src/pr-plan-record.ts +4 -2
  106. package/src/pr-post-head.test.ts +116 -0
  107. package/src/pr-post.ts +15 -5
  108. package/src/release-floors.ts +4 -4
@@ -0,0 +1,52 @@
1
+ [
2
+ {
3
+ "type": "message",
4
+ "attachments": [
5
+ {
6
+ "contentType": "application/vnd.microsoft.card.adaptive",
7
+ "contentUrl": null,
8
+ "content": {
9
+ "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
10
+ "type": "AdaptiveCard",
11
+ "version": "1.4",
12
+ "body": [
13
+ {
14
+ "type": "TextBlock",
15
+ "text": "terragucci: wave 1 (wave-1) of tf-apply waits for an approval",
16
+ "weight": "Bolder",
17
+ "wrap": true
18
+ },
19
+ {
20
+ "type": "FactSet",
21
+ "facts": [
22
+ {
23
+ "title": "Targets",
24
+ "value": "network"
25
+ },
26
+ {
27
+ "title": "Digest",
28
+ "value": "jcs1-sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
29
+ },
30
+ {
31
+ "title": "Approve",
32
+ "value": "terragucci approve tf-apply wave-1 --plan jcs1-sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
33
+ },
34
+ {
35
+ "title": "Run",
36
+ "value": "https://github.com/acme/db/actions/runs/42"
37
+ }
38
+ ]
39
+ }
40
+ ],
41
+ "actions": [
42
+ {
43
+ "type": "Action.OpenUrl",
44
+ "title": "Open the run",
45
+ "url": "https://github.com/acme/db/actions/runs/42"
46
+ }
47
+ ]
48
+ }
49
+ }
50
+ ]
51
+ }
52
+ ]
@@ -0,0 +1,92 @@
1
+ [
2
+ {
3
+ "text": "*terragucci: wave 1 (wave-1) of tf-apply waits for an approval*\nTargets: network\nDigest: `jcs1-sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`\nApprove: `terragucci approve tf-apply wave-1 --plan jcs1-sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`\nRun: <https://github.com/acme/db/actions/runs/42>",
4
+ "blocks": [
5
+ {
6
+ "type": "section",
7
+ "text": {
8
+ "type": "mrkdwn",
9
+ "text": "*terragucci: wave 1 (wave-1) of tf-apply waits for an approval*\nTargets: network\nDigest: `jcs1-sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`\nApprove: `terragucci approve tf-apply wave-1 --plan jcs1-sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`\nRun: <https://github.com/acme/db/actions/runs/42>"
10
+ }
11
+ },
12
+ {
13
+ "type": "actions",
14
+ "elements": [
15
+ {
16
+ "type": "button",
17
+ "text": {
18
+ "type": "plain_text",
19
+ "text": "Approve"
20
+ },
21
+ "action_id": "chant-approve",
22
+ "value": "eyJ2IjoxLCJpZCI6ImQ0MDM4OWRjOWM2ZDAzZDUxYTU3MDE5NzQ4OTMyMWU5N2Q0NWNjMGJkODg0NmExMGM1N2I5MDQ2YTMxMmI4YjIiLCJzb3VyY2UiOiJ0ZXJyYWd1Y2NpIiwiYXQiOiIyMDI2LTEwLTExVDEyOjAwOjAwLjAwMFoiLCJnYXRlIjoid2F2ZS0xIiwiZGlnZXN0IjoiamNzMS1zaGEyNTY6YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYSJ9.6122dfab74cb9b2729f23dae8546cf5948d4b01cc34fdb33dfa128c1a6772437",
23
+ "style": "primary"
24
+ },
25
+ {
26
+ "type": "button",
27
+ "text": {
28
+ "type": "plain_text",
29
+ "text": "Decline"
30
+ },
31
+ "action_id": "chant-decline",
32
+ "value": "eyJ2IjoxLCJpZCI6ImQ0MDM4OWRjOWM2ZDAzZDUxYTU3MDE5NzQ4OTMyMWU5N2Q0NWNjMGJkODg0NmExMGM1N2I5MDQ2YTMxMmI4YjIiLCJzb3VyY2UiOiJ0ZXJyYWd1Y2NpIiwiYXQiOiIyMDI2LTEwLTExVDEyOjAwOjAwLjAwMFoiLCJnYXRlIjoid2F2ZS0xIiwiZGlnZXN0IjoiamNzMS1zaGEyNTY6YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYSJ9.6122dfab74cb9b2729f23dae8546cf5948d4b01cc34fdb33dfa128c1a6772437"
33
+ }
34
+ ]
35
+ }
36
+ ]
37
+ },
38
+ {
39
+ "type": "message",
40
+ "attachments": [
41
+ {
42
+ "contentType": "application/vnd.microsoft.card.adaptive",
43
+ "contentUrl": null,
44
+ "content": {
45
+ "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
46
+ "type": "AdaptiveCard",
47
+ "version": "1.4",
48
+ "body": [
49
+ {
50
+ "type": "TextBlock",
51
+ "text": "terragucci: wave 1 (wave-1) of tf-apply waits for an approval",
52
+ "weight": "Bolder",
53
+ "wrap": true
54
+ },
55
+ {
56
+ "type": "FactSet",
57
+ "facts": [
58
+ {
59
+ "title": "Targets",
60
+ "value": "network"
61
+ },
62
+ {
63
+ "title": "Digest",
64
+ "value": "jcs1-sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
65
+ },
66
+ {
67
+ "title": "Approve",
68
+ "value": "terragucci approve tf-apply wave-1 --plan jcs1-sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
69
+ },
70
+ {
71
+ "title": "Run",
72
+ "value": "https://github.com/acme/db/actions/runs/42"
73
+ },
74
+ {
75
+ "title": "Approve in chat",
76
+ "value": "mention the relay and reply: approve eyJ2IjoxLCJpZCI6ImQ0MDM4OWRjOWM2ZDAzZDUxYTU3MDE5NzQ4OTMyMWU5N2Q0NWNjMGJkODg0NmExMGM1N2I5MDQ2YTMxMmI4YjIiLCJzb3VyY2UiOiJ0ZXJyYWd1Y2NpIiwiYXQiOiIyMDI2LTEwLTExVDEyOjAwOjAwLjAwMFoiLCJnYXRlIjoid2F2ZS0xIiwiZGlnZXN0IjoiamNzMS1zaGEyNTY6YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYSJ9.6122dfab74cb9b2729f23dae8546cf5948d4b01cc34fdb33dfa128c1a6772437"
77
+ }
78
+ ]
79
+ }
80
+ ],
81
+ "actions": [
82
+ {
83
+ "type": "Action.OpenUrl",
84
+ "title": "Open the run",
85
+ "url": "https://github.com/acme/db/actions/runs/42"
86
+ }
87
+ ]
88
+ }
89
+ }
90
+ ]
91
+ }
92
+ ]
@@ -54,7 +54,7 @@ import { type CiProductWords, type ParsedProductComment } from "./ci-product-wor
54
54
  import { type ForgeFetch, type PrForge } from "./pr-forge.js";
55
55
  import type { ForgeReads } from "./pr-forge-reads.js";
56
56
  import type { DecideBeforeMergeInput, WavesBeforeMergeJobs } from "./op/before-merge-decide.js";
57
- /** The comment job's name in a generated workflow (#4946). */
57
+ /** The comment job's name in a generated workflow (#4946), unless the product names it (#5027: the product pipeline's `commentJob.jobName`, such as terragucci's `apply-comment`). */
58
58
  export declare const PR_COMMENT_JOB = "comment";
59
59
  /** The variable the comment job reads the pipeline's jobs from, as JSON ({@link CommentJobs}), written by the generator (#4946). */
60
60
  export declare const COMMENT_JOBS_ENV = "CHANT_COMMENT_JOBS";
@@ -100,6 +100,14 @@ export interface CommentJobs extends Omit<ChantNoteJobs, "members"> {
100
100
  * `chant/lifecycle`, and dispatches the waves workflow for it.
101
101
  */
102
102
  wavesBeforeMerge?: WavesBeforeMergeJobs;
103
+ /**
104
+ * The waves' apply jobs by the names the product gave them (#5027, the
105
+ * Op waves generator's `jobNames`, such as terragucci's `apply-wave-<k>`,
106
+ * `apply-wave-<k>-share-<n>`, its group jobs and `apply-rest`). A re-run
107
+ * of a merged pull request's apply looks for these. Absent:
108
+ * {@link RERUN_APPLY_JOBS}.
109
+ */
110
+ applyJobs?: readonly string[];
103
111
  }
104
112
  /** What the decision before merge reads and writes with (#4984), the comment job's handler's. */
105
113
  export type CommentBeforeMerge = Pick<DecideBeforeMergeInput, "requires" | "statuses" | "git" | "cwd" | "lock" | "record" | "stop" | "now">;
@@ -116,6 +124,8 @@ export type CommentWaveStops = (op: string, sha: string, stop: {
116
124
  * terragucci's pull request loop jobs (`apply`, `apply-wave-<k>`).
117
125
  */
118
126
  export declare const RERUN_APPLY_JOBS: RegExp;
127
+ /** The apply jobs a re-run looks for (#5027): exactly `jobs.applyJobs` when the product named them, else {@link RERUN_APPLY_JOBS}. */
128
+ export declare function rerunApplyJobs(jobs: Pick<CommentJobs, "applyJobs">): RegExp;
119
129
  /** The writes a re-run makes, with the job's token. */
120
130
  export interface CommentRuns {
121
131
  /** GitHub: `POST /repos/{repo}/actions/runs/{run}/rerun-failed-jobs`. */
@@ -1 +1 @@
1
- {"version":3,"file":"ci-comment-commands.d.ts","sourceRoot":"","sources":["../src/ci-comment-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAGH,OAAO,EAAc,KAAK,UAAU,EAAqB,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACzH,OAAO,EAAuB,KAAK,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACzG,OAAO,EAAiB,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAE7F,8DAA8D;AAC9D,eAAO,MAAM,cAAc,YAAY,CAAC;AAExC,oIAAoI;AACpI,eAAO,MAAM,gBAAgB,uBAAuB,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC;IACjE,qGAAqG;IACrG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,2JAA2J;IAC3J,SAAS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pF,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,GAAG,UAAU,CAY9E;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,UAAU,CAqBnH"}
@@ -53,7 +53,7 @@ import { commentTerms, forkReply, memberReply, notRunReply } from "./ci-comment-
53
53
  import { retryApply } from "./ci-note-commands.js";
54
54
  import { parseProductComment } from "./ci-product-words.js";
55
55
  import { ForgeApiError } from "./pr-forge.js";
56
- /** The comment job's name in a generated workflow (#4946). */
56
+ /** The comment job's name in a generated workflow (#4946), unless the product names it (#5027: the product pipeline's `commentJob.jobName`, such as terragucci's `apply-comment`). */
57
57
  export const PR_COMMENT_JOB = "comment";
58
58
  /** The variable the comment job reads the pipeline's jobs from, as JSON ({@link CommentJobs}), written by the generator (#4946). */
59
59
  export const COMMENT_JOBS_ENV = "CHANT_COMMENT_JOBS";
@@ -63,6 +63,12 @@ export const COMMENT_JOBS_ENV = "CHANT_COMMENT_JOBS";
63
63
  * terragucci's pull request loop jobs (`apply`, `apply-wave-<k>`).
64
64
  */
65
65
  export const RERUN_APPLY_JOBS = /^(?:wave-([1-9][0-9]*)-[a-z0-9][a-z0-9_-]*|(?:[a-z0-9][a-z0-9-]*-)?apply(?:-wave-([1-9][0-9]*)(?:-share-[1-9][0-9]*)?)?)$/;
66
+ /** The apply jobs a re-run looks for (#5027): exactly `jobs.applyJobs` when the product named them, else {@link RERUN_APPLY_JOBS}. */
67
+ export function rerunApplyJobs(jobs) {
68
+ if (!jobs.applyJobs?.length)
69
+ return RERUN_APPLY_JOBS;
70
+ return new RegExp(`^(?:${jobs.applyJobs.map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})$`);
71
+ }
66
72
  /** The writes for a GitHub or Forgejo API root, repository and token. */
67
73
  export function commentRuns(opts) {
68
74
  const fetchImpl = opts.fetch ?? globalThis.fetch;
@@ -240,7 +246,8 @@ export async function answerProductComment(o) {
240
246
  count: o.jobs.waves.count,
241
247
  jobs: bm,
242
248
  words: o.words,
243
- start: (r) => o.runs.dispatch(workflow, o.base, { pr: String(r.pr), head: r.head, digest: r.digest }),
249
+ // #5022: under the waves workflow's input names, the product's when it renamed them.
250
+ start: (r) => o.runs.dispatch(workflow, o.base, { [bm.inputs?.pr ?? "pr"]: String(r.pr), [bm.inputs?.head ?? "head"]: r.head, [bm.inputs?.digest ?? "digest"]: r.digest }),
244
251
  });
245
252
  if (done.kind === "fail")
246
253
  return broke(done.reason, command);
@@ -280,7 +287,7 @@ export async function answerProductComment(o) {
280
287
  return start(run, jobs, ctx);
281
288
  }
282
289
  : start;
283
- const done = await retryApply({ reads: o.reads, forge: o.poster, words: o.words, base: o.base }, o.forge, pr, user, { kind: "retry", sha: mergeCommit, jobs: RERUN_APPLY_JOBS }, rerun);
290
+ const done = await retryApply({ reads: o.reads, forge: o.poster, words: o.words, base: o.base }, o.forge, pr, user, { kind: "retry", sha: mergeCommit, jobs: rerunApplyJobs(o.jobs) }, rerun);
284
291
  if (done.kind === "fail")
285
292
  return broke(done.reason, command);
286
293
  const stopped = done.kind === "ran" && wave !== undefined && waves && wave < waves.count ? `; it stops after \`wave-${wave}\`, and the waves after it wait until \`/${o.words.product} ${typedApply(o.words)}\` runs it again` : "";
@@ -3,6 +3,14 @@ import { type BeforeMergeRecord, type BeforeMergeRun } from "./op/before-merge.j
3
3
  import { type FollowOnRecord, type FollowOnRun } from "./op/follow-on-run.js";
4
4
  /** The variable the generated step carries its expectation in. */
5
5
  export declare const JOB_GUARD_ENV = "CHANT_JOB_GUARD";
6
+ /**
7
+ * The variable a GitHub or Forgejo job carries the repository's default
8
+ * branch in (#5032), from `github.event.repository.default_branch`. GitLab
9
+ * sets `CI_DEFAULT_BRANCH` itself.
10
+ */
11
+ export declare const JOB_DEFAULT_BRANCH_ENV = "CHANT_DEFAULT_BRANCH";
12
+ /** The job variable that sets {@link JOB_DEFAULT_BRANCH_ENV} on GitHub and Forgejo (#5032). */
13
+ export declare const GITHUB_DEFAULT_BRANCH_ENV: Record<string, string>;
6
14
  /** The audience of the token the guard requests on GitHub, which no cloud role should trust. */
7
15
  export declare const JOB_GUARD_AUDIENCE = "chant-check-job";
8
16
  export type JobGuardForge = "github" | "gitlab" | "forgejo";
@@ -17,6 +25,8 @@ export interface JobGuardSpec {
17
25
  forgeEnvironment?: string;
18
26
  /** The branches the job may run from. */
19
27
  branches: string[];
28
+ /** The job may also run from the repository's default branch, by the name the forge gives at run time (#5032). */
29
+ defaultBranch?: true;
20
30
  /** GitLab: the tags the job's runner must carry. */
21
31
  runnerTags?: string[];
22
32
  /** GitHub and Forgejo: the runner must be self-hosted. */
@@ -36,6 +46,8 @@ export interface JobSeen {
36
46
  forgeEnvironmentError?: string;
37
47
  ref?: string;
38
48
  refProtected?: string;
49
+ /** The repository's default branch, as the forge names it (#5032). Read only when the spec has `defaultBranch`. */
50
+ defaultBranch?: string;
39
51
  runnerTags?: string[];
40
52
  runnerEnvironment?: string;
41
53
  /** The decision the run names (#4984), from its variables. */
@@ -68,6 +80,8 @@ export interface JobGuardInput {
68
80
  environment?: string;
69
81
  /** The branches the job runs from. */
70
82
  branches: readonly string[];
83
+ /** The job also runs from the repository's default branch, whatever the forge calls it (#5032). */
84
+ defaultBranch?: boolean;
71
85
  /** The job's runner, as the spec gives it. */
72
86
  runner?: CiRunner;
73
87
  /** GitHub: the job may request an OIDC token (`id-token: write`), so the guard can read its environment. */
@@ -115,16 +129,16 @@ export declare function describeJobGuard(expect: JobGuardSpec, result: JobGuardR
115
129
  out: string[];
116
130
  err: string[];
117
131
  };
132
+ /** The guard as one `node -e` program; see {@link jobGuardProgram}. */
133
+ export declare const JOB_GUARD_JS: string;
134
+ /** The same program for a spec with `defaultBranch` (#5032), which also reads the default branch. */
135
+ export declare const JOB_GUARD_DEFAULT_BRANCH_JS: string;
118
136
  /**
119
- * The guard as one `node -e` program: the same checks as {@link checkJob},
120
- * {@link jobSeen} and {@link describeJobGuard}, reading {@link JOB_GUARD_ENV}.
121
- * Exits chant's `misplaced` (9) with one line per value that differs, and
122
- * when the variable holds no spec it can read. A test runs it against
123
- * {@link checkJob} so the two stay the same.
137
+ * The shell line of the guard step: `node -e` from `/`, so no file of the
138
+ * checkout is in reach. #5032: a spec with `defaultBranch` gets the program
139
+ * that reads the default branch.
124
140
  */
125
- export declare const JOB_GUARD_JS: string;
126
- /** The shell line of the guard step: `node -e` from `/`, so no file of the checkout is in reach. */
127
- export declare function jobGuardLine(): string;
141
+ export declare function jobGuardLine(spec?: Pick<JobGuardSpec, "defaultBranch">): string;
128
142
  /** How the guard's lines name an op-wave job: `wave 2 (prod) of deploy`, `share 1 of job group eu of wave 2 (prod) of deploy`. */
129
143
  export declare function opWaveJobLabel(spec: string, job: {
130
144
  kind: "wave" | "decide" | "share";
@@ -1 +1 @@
1
- {"version":3,"file":"ci-job-guard.d.ts","sourceRoot":"","sources":["../src/ci-job-guard.ts"],"names":[],"mappings":"AA0EA,OAAO,EAAiB,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,EAAwK,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACtP,OAAO,EAAqI,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE9M,kEAAkE;AAClE,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAE/C,gGAAgG;AAChG,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AAEpD,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE5D,8DAA8D;AAC9D,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,aAAa,CAAC;IACrB,gEAAgE;IAChE,GAAG,EAAE,MAAM,CAAC;IACZ,6EAA6E;IAC7E,OAA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E,eAAO,MAAM,YAAY,QAAyB,CAAC;AAEnD,qGAAqG;AACrG,eAAO,MAAM,2BAA2B,QAAwB,CAAC;AAEjE;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,MAAM,CAE/E;AAED,kIAAkI;AAClI,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE;IAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAM/J"}
@@ -17,7 +17,12 @@
17
17
  * ref GitHub and Forgejo: GITHUB_REF is refs/heads/<branch>
18
18
  * for one of the branches the waves apply from. GitLab:
19
19
  * CI_COMMIT_REF_NAME is one of them, and
20
- * CI_COMMIT_REF_PROTECTED is "true".
20
+ * CI_COMMIT_REF_PROTECTED is "true". With
21
+ * `defaultBranch` (#5032) the repository's default
22
+ * branch is one of them, by the name the forge gives
23
+ * at run time: GitLab's CI_DEFAULT_BRANCH, and on
24
+ * GitHub and Forgejo CHANT_DEFAULT_BRANCH, which the
25
+ * job sets from github.event.repository.default_branch.
21
26
  * runner GitLab: CI_RUNNER_TAGS holds each of the job's tags.
22
27
  * GitHub and Forgejo expose no labels, only whether the
23
28
  * runner is self-hosted: when the job's labels include
@@ -78,6 +83,14 @@ import { BEFORE_MERGE_DIGEST_ENV, BEFORE_MERGE_HEAD_ENV, BEFORE_MERGE_PR_ENV, be
78
83
  import { followOnPath, followOnProblems, followOnRecordProblems, followOnRunFromEnv, OP_WAVES_COMMIT_ENV, OP_WAVES_WAVE_ENV, parseFollowOn } from "./op/follow-on-run.js";
79
84
  /** The variable the generated step carries its expectation in. */
80
85
  export const JOB_GUARD_ENV = "CHANT_JOB_GUARD";
86
+ /**
87
+ * The variable a GitHub or Forgejo job carries the repository's default
88
+ * branch in (#5032), from `github.event.repository.default_branch`. GitLab
89
+ * sets `CI_DEFAULT_BRANCH` itself.
90
+ */
91
+ export const JOB_DEFAULT_BRANCH_ENV = "CHANT_DEFAULT_BRANCH";
92
+ /** The job variable that sets {@link JOB_DEFAULT_BRANCH_ENV} on GitHub and Forgejo (#5032). */
93
+ export const GITHUB_DEFAULT_BRANCH_ENV = { [JOB_DEFAULT_BRANCH_ENV]: "${{ github.event.repository.default_branch }}" };
81
94
  /** The audience of the token the guard requests on GitHub, which no cloud role should trust. */
82
95
  export const JOB_GUARD_AUDIENCE = "chant-check-job";
83
96
  /**
@@ -93,6 +106,7 @@ export function jobGuardSpec(input) {
93
106
  ...(input.product && input.product !== "chant" ? { product: input.product } : {}),
94
107
  ...(input.environment !== undefined && readsEnvironment ? { forgeEnvironment: input.environment } : {}),
95
108
  branches: [...input.branches],
109
+ ...(input.defaultBranch === true ? { defaultBranch: true } : {}),
96
110
  ...(input.forge === "gitlab" && labels.length > 0 ? { runnerTags: labels } : {}),
97
111
  ...(input.forge !== "gitlab" && labels.includes("self-hosted") ? { selfHosted: true } : {}),
98
112
  ...(input.beforeMerge ? { beforeMerge: { op: input.beforeMerge.op } } : {}),
@@ -119,6 +133,8 @@ export function parseJobGuardSpec(raw) {
119
133
  throw new Error(`${JOB_GUARD_ENV}.job names no job`);
120
134
  if (!Array.isArray(o.branches) || o.branches.some((b) => typeof b !== "string"))
121
135
  throw new Error(`${JOB_GUARD_ENV}.branches is not a list of branches`);
136
+ if (o.defaultBranch !== undefined && o.defaultBranch !== true)
137
+ throw new Error(`${JOB_GUARD_ENV}.defaultBranch is true or absent`);
122
138
  if (o.forgeEnvironment !== undefined && typeof o.forgeEnvironment !== "string")
123
139
  throw new Error(`${JOB_GUARD_ENV}.forgeEnvironment is not a name`);
124
140
  if (o.runnerTags !== undefined && (!Array.isArray(o.runnerTags) || o.runnerTags.some((t) => typeof t !== "string")))
@@ -130,6 +146,8 @@ export function parseJobGuardSpec(raw) {
130
146
  return o;
131
147
  }
132
148
  const shown = (v) => (v === undefined || v === null || v === "" ? "none" : v);
149
+ /** The variable the guard reads the default branch from (#5032). */
150
+ const defaultBranchVar = (forge) => (forge === "gitlab" ? "CI_DEFAULT_BRANCH" : JOB_DEFAULT_BRANCH_ENV);
133
151
  /** The tags CI_RUNNER_TAGS lists: a JSON array, or a comma-separated list. */
134
152
  export function runnerTagsOf(raw) {
135
153
  if (raw === undefined)
@@ -172,9 +190,12 @@ export function checkJob(expect, seen) {
172
190
  else
173
191
  out.checked.push(`forge environment ${fe}`);
174
192
  }
175
- const branches = expect.branches.filter((b) => b !== "");
193
+ // #5032: the repository's default branch, by the name the forge gives this run, beside the named ones.
194
+ const named = expect.branches.filter((b) => b !== "");
195
+ const def = expect.defaultBranch ? (seen.defaultBranch ?? "").trim() : "";
196
+ const branches = def !== "" && !named.includes(def) ? [def, ...named] : named;
176
197
  if (branches.length === 0)
177
- out.problems.push("ref: the job names no branch to run from");
198
+ out.problems.push(expect.defaultBranch ? `ref: the job runs from the default branch, and the forge names none (no ${defaultBranchVar(expect.forge)})` : "ref: the job names no branch to run from");
178
199
  else if (expect.forge === "gitlab") {
179
200
  if (!seen.ref || !branches.includes(seen.ref))
180
201
  out.problems.push(`ref: expected ${branches.join(" or ")}, found ${shown(seen.ref)}`);
@@ -328,15 +349,19 @@ export const lifecycleFileByGit = (forge, env, path) => {
328
349
  };
329
350
  /** What the forge's own variables and token say, before the decision is read. */
330
351
  async function forgeSeen(expect, env, fetchFn) {
352
+ // #5032: the default branch, read only when the spec runs from it.
353
+ const def = expect.defaultBranch ? env[defaultBranchVar(expect.forge)] : undefined;
354
+ const defaultBranch = def !== undefined && def.trim() !== "" ? { defaultBranch: def.trim() } : {};
331
355
  if (expect.forge === "gitlab") {
332
356
  return {
357
+ ...defaultBranch,
333
358
  forgeEnvironment: env.CI_ENVIRONMENT_NAME || null,
334
359
  ...(env.CI_COMMIT_REF_NAME !== undefined ? { ref: env.CI_COMMIT_REF_NAME } : {}),
335
360
  ...(env.CI_COMMIT_REF_PROTECTED !== undefined ? { refProtected: env.CI_COMMIT_REF_PROTECTED } : {}),
336
361
  ...(env.CI_RUNNER_TAGS !== undefined ? { runnerTags: runnerTagsOf(env.CI_RUNNER_TAGS) } : {}),
337
362
  };
338
363
  }
339
- const seen = { ...(env.GITHUB_REF !== undefined ? { ref: env.GITHUB_REF } : {}) };
364
+ const seen = { ...(env.GITHUB_REF !== undefined ? { ref: env.GITHUB_REF } : {}), ...defaultBranch };
340
365
  let claims;
341
366
  if (expect.forge === "github" && expect.forgeEnvironment !== undefined) {
342
367
  try {
@@ -431,52 +456,71 @@ const FOLLOW_ON_JS = [
431
456
  * Exits chant's `misplaced` (9) with one line per value that differs, and
432
457
  * when the variable holds no spec it can read. A test runs it against
433
458
  * {@link checkJob} so the two stay the same.
459
+ *
460
+ * `defaultBranch` (#5032) gives the program that also reads the default
461
+ * branch, for a spec with `defaultBranch`; a job without it carries the
462
+ * program as it was.
463
+ */
464
+ function jobGuardProgram(defaultBranch) {
465
+ const branchLines = defaultBranch
466
+ ? [
467
+ `const b=x.branches.filter((v)=>v!=="");const DV=x.forge==="gitlab"?"CI_DEFAULT_BRANCH":${JSON.stringify(JOB_DEFAULT_BRANCH_ENV)};const D=x.defaultBranch?String(E[DV]||"").trim():"";if(D!==""&&!b.includes(D))b.unshift(D);`,
468
+ 'if(b.length===0)P.push(x.defaultBranch?"ref: the job runs from the default branch, and the forge names none (no "+DV+")":"ref: the job names no branch to run from");',
469
+ ]
470
+ : ['const b=x.branches.filter((v)=>v!=="");', 'if(b.length===0)P.push("ref: the job names no branch to run from");'];
471
+ return [
472
+ '"use strict";',
473
+ `const E=process.env,A=${JSON.stringify(JOB_GUARD_AUDIENCE)};`,
474
+ "const shown=(v)=>v===undefined||v===null||v===\"\"?\"none\":v;",
475
+ `const fail=(m)=>{console.error("check-job: "+m);process.exit(${CHANT_EXIT.misplaced})};`,
476
+ "let x;try{x=JSON.parse(E." + JOB_GUARD_ENV + "||\"\")}catch(e){fail(\"" + JOB_GUARD_ENV + " is not JSON\")}",
477
+ "if(!x||![\"github\",\"gitlab\",\"forgejo\"].includes(x.forge)||!Array.isArray(x.branches))fail(\"" + JOB_GUARD_ENV + " is not a guard spec\");",
478
+ 'const tags=(r)=>{if(r===undefined)return undefined;const t=r.trim();if(t.startsWith("[")){try{const v=JSON.parse(t);if(Array.isArray(v))return v.map(String)}catch(e){}}return t===""?[]:t.split(",").map((s)=>s.trim()).filter((s)=>s!=="")};',
479
+ 'const claimsOf=(tok)=>{const p=tok.split(".")[1];if(!p)throw new Error("the forge\\u0027s OIDC token is not a JWT");const c=JSON.parse(Buffer.from(p.replace(/-/g,"+").replace(/_/g,"/"),"base64").toString("utf-8"));if(!c||typeof c!=="object")throw new Error("the forge\\u0027s OIDC token has no claims");return c};',
480
+ ...BEFORE_MERGE_JS,
481
+ ...FOLLOW_ON_JS,
482
+ "async function seenOf(){",
483
+ 'if(x.forge==="gitlab")return foSeen(bmSeen({forgeEnvironment:E.CI_ENVIRONMENT_NAME||null,ref:E.CI_COMMIT_REF_NAME,refProtected:E.CI_COMMIT_REF_PROTECTED,runnerTags:tags(E.CI_RUNNER_TAGS)}));',
484
+ "const s={ref:E.GITHUB_REF};let c;",
485
+ 'if(x.forge==="github"&&x.forgeEnvironment!==undefined){try{',
486
+ 'if(!E.ACTIONS_ID_TOKEN_REQUEST_URL||!E.ACTIONS_ID_TOKEN_REQUEST_TOKEN)throw new Error("the job may request no OIDC token (no ACTIONS_ID_TOKEN_REQUEST_URL); it needs the id-token: write permission");',
487
+ 'const r=await fetch(E.ACTIONS_ID_TOKEN_REQUEST_URL+"&audience="+encodeURIComponent(A),{headers:{authorization:"bearer "+E.ACTIONS_ID_TOKEN_REQUEST_TOKEN}});',
488
+ 'if(!r.ok)throw new Error("the OIDC token request answered "+r.status);const v=(await r.json()).value;if(typeof v!=="string")throw new Error("the OIDC token request answered no token");',
489
+ 'c=claimsOf(v);s.forgeEnvironment=typeof c.environment==="string"&&c.environment!==""?c.environment:null}catch(e){s.forgeEnvironmentError=e&&e.message?e.message:String(e)}}',
490
+ 'const run=c&&typeof c.runner_environment==="string"?c.runner_environment:E.RUNNER_ENVIRONMENT;if(run)s.runnerEnvironment=run;return foSeen(bmSeen(s))}',
491
+ "seenOf().then((s)=>{const P=[],C=[],S=[];const fe=x.forgeEnvironment;",
492
+ 'if(x.forge==="forgejo")S.push("forge environment (Forgejo has none)");',
493
+ 'else if(fe!==undefined){if(s.forgeEnvironmentError!==undefined)P.push("forge environment: expected "+fe+", and it could not be read: "+s.forgeEnvironmentError);else if(s.forgeEnvironment!==fe)P.push("forge environment: expected "+fe+", found "+shown(s.forgeEnvironment));else C.push("forge environment "+fe)}',
494
+ ...branchLines,
495
+ 'else if(x.forge==="gitlab"){if(!s.ref||!b.includes(s.ref))P.push("ref: expected "+b.join(" or ")+", found "+shown(s.ref));else C.push("ref "+s.ref);',
496
+ 'if(s.refProtected!=="true")P.push("ref: expected a protected ref (CI_COMMIT_REF_PROTECTED true), found "+shown(s.refProtected));else C.push("protected ref")}',
497
+ 'else{const refs=b.map((v)=>"refs/heads/"+v);if(!s.ref||!refs.includes(s.ref))P.push("ref: expected "+refs.join(" or ")+", found "+shown(s.ref));else C.push("ref "+s.ref)}',
498
+ ...[
499
+ String.raw `if(s.beforeMerge){const r=s.beforeMerge;if(!x.beforeMerge)P.push("before merge: the run names pull request "+(r.pr||"none")+"'s head "+(r.head||"none")+", and this job applies only the pushes to its branches");`,
500
+ String.raw `else if(s.bmErr!==undefined)P.push("before merge: the decisions on chant/lifecycle could not be read: "+s.bmErr);`,
501
+ String.raw `else{const Q=bmProblems(x.beforeMerge.op,r,s.rec||undefined);if(Q.length)P.push(...Q);else C.push("before merge: pull request "+r.pr+"'s decided head "+r.head.slice(0,12))}}`,
502
+ ].map(noQuote),
503
+ "{const F=foProblems(x.rest,foRun,bmOn);P.push(...F.p);if(F.c){const G=!x.beforeMerge?[\"follow-on: this job names no op whose follow-on records it reads, so it admits no follow-on\"]:s.foErr!==undefined?[\"follow-on: the follow-on records on chant/lifecycle could not be read: \"+s.foErr]:foRecProblems(x.beforeMerge.op,foRun.wave,(bmOn?bmRun.head:foRun.commit)||\"\",bmOn?(bmRun.digest||\"\"):undefined,s.foRec);if(G.length)P.push(...G);else C.push(F.c)}}",
504
+ 'if(x.forge==="gitlab"){const w=x.runnerTags||[];if(w.length>0){const h=s.runnerTags;const miss=w.filter((t)=>!(h||[]).includes(t));',
505
+ 'if(h===undefined)P.push("runner: expected tags "+w.join(", ")+", and the job has no CI_RUNNER_TAGS");else if(miss.length>0)P.push("runner: expected tags "+w.join(", ")+", found "+(h.length?h.join(", "):"none"));else C.push("runner tags "+w.join(", "))}}',
506
+ 'else if(x.selfHosted){if(s.runnerEnvironment===undefined)S.push("runner (the runner says nothing about itself: no RUNNER_ENVIRONMENT)");else if(s.runnerEnvironment!=="self-hosted")P.push("runner: expected self-hosted, found "+s.runnerEnvironment);else C.push("self-hosted runner")}',
507
+ 'const at=(x.product||"chant")+" check-job: "+x.job;',
508
+ 'if(P.length>0){for(const p of P)console.error(at+": "+p);console.error(at+": this job does not run where the spec set it to run, so it stops before any credential is taken or code checked out");process.exit(' + CHANT_EXIT.misplaced + ")}",
509
+ 'console.log(at+": "+(C.length?C.join(", "):"nothing to check")+(S.length?"; not checked: "+S.join(", "):""))',
510
+ "}).catch((e)=>fail(e&&e.message?e.message:String(e)));",
511
+ ].join("");
512
+ }
513
+ /** The guard as one `node -e` program; see {@link jobGuardProgram}. */
514
+ export const JOB_GUARD_JS = jobGuardProgram(false);
515
+ /** The same program for a spec with `defaultBranch` (#5032), which also reads the default branch. */
516
+ export const JOB_GUARD_DEFAULT_BRANCH_JS = jobGuardProgram(true);
517
+ /**
518
+ * The shell line of the guard step: `node -e` from `/`, so no file of the
519
+ * checkout is in reach. #5032: a spec with `defaultBranch` gets the program
520
+ * that reads the default branch.
434
521
  */
435
- export const JOB_GUARD_JS = [
436
- '"use strict";',
437
- `const E=process.env,A=${JSON.stringify(JOB_GUARD_AUDIENCE)};`,
438
- "const shown=(v)=>v===undefined||v===null||v===\"\"?\"none\":v;",
439
- `const fail=(m)=>{console.error("check-job: "+m);process.exit(${CHANT_EXIT.misplaced})};`,
440
- "let x;try{x=JSON.parse(E." + JOB_GUARD_ENV + "||\"\")}catch(e){fail(\"" + JOB_GUARD_ENV + " is not JSON\")}",
441
- "if(!x||![\"github\",\"gitlab\",\"forgejo\"].includes(x.forge)||!Array.isArray(x.branches))fail(\"" + JOB_GUARD_ENV + " is not a guard spec\");",
442
- 'const tags=(r)=>{if(r===undefined)return undefined;const t=r.trim();if(t.startsWith("[")){try{const v=JSON.parse(t);if(Array.isArray(v))return v.map(String)}catch(e){}}return t===""?[]:t.split(",").map((s)=>s.trim()).filter((s)=>s!=="")};',
443
- 'const claimsOf=(tok)=>{const p=tok.split(".")[1];if(!p)throw new Error("the forge\\u0027s OIDC token is not a JWT");const c=JSON.parse(Buffer.from(p.replace(/-/g,"+").replace(/_/g,"/"),"base64").toString("utf-8"));if(!c||typeof c!=="object")throw new Error("the forge\\u0027s OIDC token has no claims");return c};',
444
- ...BEFORE_MERGE_JS,
445
- ...FOLLOW_ON_JS,
446
- "async function seenOf(){",
447
- 'if(x.forge==="gitlab")return foSeen(bmSeen({forgeEnvironment:E.CI_ENVIRONMENT_NAME||null,ref:E.CI_COMMIT_REF_NAME,refProtected:E.CI_COMMIT_REF_PROTECTED,runnerTags:tags(E.CI_RUNNER_TAGS)}));',
448
- "const s={ref:E.GITHUB_REF};let c;",
449
- 'if(x.forge==="github"&&x.forgeEnvironment!==undefined){try{',
450
- 'if(!E.ACTIONS_ID_TOKEN_REQUEST_URL||!E.ACTIONS_ID_TOKEN_REQUEST_TOKEN)throw new Error("the job may request no OIDC token (no ACTIONS_ID_TOKEN_REQUEST_URL); it needs the id-token: write permission");',
451
- 'const r=await fetch(E.ACTIONS_ID_TOKEN_REQUEST_URL+"&audience="+encodeURIComponent(A),{headers:{authorization:"bearer "+E.ACTIONS_ID_TOKEN_REQUEST_TOKEN}});',
452
- 'if(!r.ok)throw new Error("the OIDC token request answered "+r.status);const v=(await r.json()).value;if(typeof v!=="string")throw new Error("the OIDC token request answered no token");',
453
- 'c=claimsOf(v);s.forgeEnvironment=typeof c.environment==="string"&&c.environment!==""?c.environment:null}catch(e){s.forgeEnvironmentError=e&&e.message?e.message:String(e)}}',
454
- 'const run=c&&typeof c.runner_environment==="string"?c.runner_environment:E.RUNNER_ENVIRONMENT;if(run)s.runnerEnvironment=run;return foSeen(bmSeen(s))}',
455
- "seenOf().then((s)=>{const P=[],C=[],S=[];const fe=x.forgeEnvironment;",
456
- 'if(x.forge==="forgejo")S.push("forge environment (Forgejo has none)");',
457
- 'else if(fe!==undefined){if(s.forgeEnvironmentError!==undefined)P.push("forge environment: expected "+fe+", and it could not be read: "+s.forgeEnvironmentError);else if(s.forgeEnvironment!==fe)P.push("forge environment: expected "+fe+", found "+shown(s.forgeEnvironment));else C.push("forge environment "+fe)}',
458
- 'const b=x.branches.filter((v)=>v!=="");',
459
- 'if(b.length===0)P.push("ref: the job names no branch to run from");',
460
- 'else if(x.forge==="gitlab"){if(!s.ref||!b.includes(s.ref))P.push("ref: expected "+b.join(" or ")+", found "+shown(s.ref));else C.push("ref "+s.ref);',
461
- 'if(s.refProtected!=="true")P.push("ref: expected a protected ref (CI_COMMIT_REF_PROTECTED true), found "+shown(s.refProtected));else C.push("protected ref")}',
462
- 'else{const refs=b.map((v)=>"refs/heads/"+v);if(!s.ref||!refs.includes(s.ref))P.push("ref: expected "+refs.join(" or ")+", found "+shown(s.ref));else C.push("ref "+s.ref)}',
463
- ...[
464
- String.raw `if(s.beforeMerge){const r=s.beforeMerge;if(!x.beforeMerge)P.push("before merge: the run names pull request "+(r.pr||"none")+"'s head "+(r.head||"none")+", and this job applies only the pushes to its branches");`,
465
- String.raw `else if(s.bmErr!==undefined)P.push("before merge: the decisions on chant/lifecycle could not be read: "+s.bmErr);`,
466
- String.raw `else{const Q=bmProblems(x.beforeMerge.op,r,s.rec||undefined);if(Q.length)P.push(...Q);else C.push("before merge: pull request "+r.pr+"'s decided head "+r.head.slice(0,12))}}`,
467
- ].map(noQuote),
468
- "{const F=foProblems(x.rest,foRun,bmOn);P.push(...F.p);if(F.c){const G=!x.beforeMerge?[\"follow-on: this job names no op whose follow-on records it reads, so it admits no follow-on\"]:s.foErr!==undefined?[\"follow-on: the follow-on records on chant/lifecycle could not be read: \"+s.foErr]:foRecProblems(x.beforeMerge.op,foRun.wave,(bmOn?bmRun.head:foRun.commit)||\"\",bmOn?(bmRun.digest||\"\"):undefined,s.foRec);if(G.length)P.push(...G);else C.push(F.c)}}",
469
- 'if(x.forge==="gitlab"){const w=x.runnerTags||[];if(w.length>0){const h=s.runnerTags;const miss=w.filter((t)=>!(h||[]).includes(t));',
470
- 'if(h===undefined)P.push("runner: expected tags "+w.join(", ")+", and the job has no CI_RUNNER_TAGS");else if(miss.length>0)P.push("runner: expected tags "+w.join(", ")+", found "+(h.length?h.join(", "):"none"));else C.push("runner tags "+w.join(", "))}}',
471
- 'else if(x.selfHosted){if(s.runnerEnvironment===undefined)S.push("runner (the runner says nothing about itself: no RUNNER_ENVIRONMENT)");else if(s.runnerEnvironment!=="self-hosted")P.push("runner: expected self-hosted, found "+s.runnerEnvironment);else C.push("self-hosted runner")}',
472
- 'const at=(x.product||"chant")+" check-job: "+x.job;',
473
- 'if(P.length>0){for(const p of P)console.error(at+": "+p);console.error(at+": this job does not run where the spec set it to run, so it stops before any credential is taken or code checked out");process.exit(' + CHANT_EXIT.misplaced + ")}",
474
- 'console.log(at+": "+(C.length?C.join(", "):"nothing to check")+(S.length?"; not checked: "+S.join(", "):""))',
475
- "}).catch((e)=>fail(e&&e.message?e.message:String(e)));",
476
- ].join("");
477
- /** The shell line of the guard step: `node -e` from `/`, so no file of the checkout is in reach. */
478
- export function jobGuardLine() {
479
- return `(cd / && node -e '${JOB_GUARD_JS}')`;
522
+ export function jobGuardLine(spec) {
523
+ return `(cd / && node -e '${spec?.defaultBranch ? JOB_GUARD_DEFAULT_BRANCH_JS : JOB_GUARD_JS}')`;
480
524
  }
481
525
  /** How the guard's lines name an op-wave job: `wave 2 (prod) of deploy`, `share 1 of job group eu of wave 2 (prod) of deploy`. */
482
526
  export function opWaveJobLabel(spec, job) {
package/dist/ci-jobs.d.ts CHANGED
@@ -50,6 +50,28 @@ export declare const PR_ENV_REPORT_DIR = ".chant/pr-env";
50
50
  * forge.
51
51
  */
52
52
  export declare function pushBranches(branches: readonly string[] | undefined): string[];
53
+ /**
54
+ * The branches an Op waves spec names (#5032): with `defaultBranch` its
55
+ * `branches` alone, beside the repository's default branch that the forge
56
+ * names at run time; without it {@link pushBranches}'.
57
+ */
58
+ export declare function wavesNamedBranches(spec: {
59
+ branches?: readonly string[];
60
+ defaultBranch?: boolean;
61
+ }): string[];
62
+ /** GitHub and Forgejo: the `if:` expression for a ref the waves run from (#5032), the default branch first. */
63
+ export declare function githubWavesBranchIf(spec: {
64
+ branches?: readonly string[];
65
+ defaultBranch?: boolean;
66
+ }): string;
67
+ /** GitLab: each branch a waves spec runs from as a rule's operand (#5032): `$CI_DEFAULT_BRANCH`, then each named one quoted. */
68
+ export declare function gitlabWavesBranches(spec: {
69
+ branches?: readonly string[];
70
+ defaultBranch?: boolean;
71
+ }): Array<{
72
+ branch: string;
73
+ operand: string;
74
+ }>;
53
75
  /**
54
76
  * The branches a trigger filters on: a `pull_request` trigger's list, or
55
77
  * undefined for every branch; a `push` trigger's, with {@link pushBranches}'
@@ -1 +1 @@
1
- {"version":3,"file":"ci-jobs.d.ts","sourceRoot":"","sources":["../src/ci-jobs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,W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