@intentius/chant-lexicon-github 0.124.45 → 0.124.48

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 (69) hide show
  1. package/dist/action-pins.d.ts +17 -27
  2. package/dist/action-pins.d.ts.map +1 -1
  3. package/dist/action-pins.js +39 -27
  4. package/dist/components/ci-jobs.d.ts +5 -2
  5. package/dist/components/ci-jobs.d.ts.map +1 -1
  6. package/dist/components/ci-jobs.js +8 -5
  7. package/dist/components/generate-op-pipeline.d.ts +7 -0
  8. package/dist/components/generate-op-pipeline.d.ts.map +1 -1
  9. package/dist/components/generate-op-pipeline.js +26 -3
  10. package/dist/components/generate-op-waves-pipeline.d.ts +13 -3
  11. package/dist/components/generate-op-waves-pipeline.d.ts.map +1 -1
  12. package/dist/components/generate-op-waves-pipeline.js +24 -5
  13. package/dist/components/generate-pipeline.d.ts.map +1 -1
  14. package/dist/components/generate-pipeline.js +55 -10
  15. package/dist/components/review-jobs.d.ts +55 -0
  16. package/dist/components/review-jobs.d.ts.map +1 -0
  17. package/dist/components/review-jobs.js +130 -0
  18. package/dist/composites/cache.d.ts.map +1 -1
  19. package/dist/composites/cache.js +2 -1
  20. package/dist/composites/checkout.d.ts +3 -3
  21. package/dist/composites/checkout.js +1 -1
  22. package/dist/composites/docker-build.js +4 -4
  23. package/dist/composites/download-artifact.d.ts.map +1 -1
  24. package/dist/composites/download-artifact.js +2 -1
  25. package/dist/composites/go-ci.js +4 -4
  26. package/dist/composites/node-pipeline.js +5 -5
  27. package/dist/composites/python-ci.js +2 -2
  28. package/dist/composites/setup-go.d.ts.map +1 -1
  29. package/dist/composites/setup-go.js +2 -1
  30. package/dist/composites/setup-node.d.ts +3 -3
  31. package/dist/composites/setup-node.js +1 -1
  32. package/dist/composites/setup-python.d.ts.map +1 -1
  33. package/dist/composites/setup-python.js +2 -1
  34. package/dist/composites/upload-artifact.d.ts.map +1 -1
  35. package/dist/composites/upload-artifact.js +2 -1
  36. package/dist/integrity.json +2 -2
  37. package/dist/manifest.json +1 -1
  38. package/package.json +2 -2
  39. package/src/action-pins.test.ts +29 -6
  40. package/src/action-pins.ts +48 -34
  41. package/src/components/__fixtures__/pr-loop-build.github.golden.yml +8 -9
  42. package/src/components/__fixtures__/pr-loop-record.github.golden.yml +4 -5
  43. package/src/components/__fixtures__/pr-loop-waves.github.golden.yml +16 -17
  44. package/src/components/__fixtures__/pr-loop.github.golden.yml +8 -9
  45. package/src/components/__golden__/op-waves-jobs.yml +71 -9
  46. package/src/components/ci-jobs.ts +8 -5
  47. package/src/components/generate-op-pipeline.review.test.ts +152 -0
  48. package/src/components/generate-op-pipeline.test.ts +5 -4
  49. package/src/components/generate-op-pipeline.ts +33 -3
  50. package/src/components/generate-op-waves-pipeline.test.ts +2 -1
  51. package/src/components/generate-op-waves-pipeline.ts +25 -5
  52. package/src/components/generate-pipeline.test.ts +10 -9
  53. package/src/components/generate-pipeline.ts +57 -9
  54. package/src/components/generate-pr-pipeline.locks.test.ts +68 -0
  55. package/src/components/generate-pr-pipeline.test.ts +6 -4
  56. package/src/components/generate-pr-waves-pipeline.test.ts +3 -2
  57. package/src/components/review-jobs.ts +165 -0
  58. package/src/composites/cache.ts +2 -1
  59. package/src/composites/checkout.ts +4 -4
  60. package/src/composites/composites.test.ts +23 -22
  61. package/src/composites/docker-build.ts +4 -4
  62. package/src/composites/download-artifact.ts +2 -1
  63. package/src/composites/go-ci.ts +4 -4
  64. package/src/composites/node-pipeline.ts +5 -5
  65. package/src/composites/python-ci.ts +2 -2
  66. package/src/composites/setup-go.ts +2 -1
  67. package/src/composites/setup-node.ts +4 -4
  68. package/src/composites/setup-python.ts +2 -1
  69. package/src/composites/upload-artifact.ts +2 -1
@@ -1,22 +1,23 @@
1
1
  /**
2
- * The action versions the github lexicon emits, and the commit each release
3
- * tag points at.
2
+ * The action versions the github lexicon emits. The table is core's
3
+ * (`@intentius/chant/action-pins`, #4403); this file reads it, so an update is
4
+ * one change there (#4410). Each action here is its newest row in core's table,
5
+ * pinned at the commit of its latest release.
4
6
  *
5
- * Composites emit `<slug>@<major>` by default. With `pin: "sha"` they emit
6
- * `<slug>@<sha> # <version>`, the form GHA021 and GHA029 accept and GHA059
7
- * reads the version label from. The serializer writes the `# <version>` part
8
- * as a YAML comment, so GitHub sees only the SHA.
7
+ * Composites emit `<slug>@<sha> # <version>` by default, the form GHA021 and
8
+ * GHA029 accept and GHA059 reads the version label from. The serializer writes
9
+ * the `# <version>` part as a YAML comment, so GitHub sees only the SHA. With
10
+ * `pin: "tag"` they emit the major tag (`actions/checkout@v7`).
9
11
  *
10
- * Refresh a row by resolving the release tag to its commit:
12
+ * Refresh a row in core by resolving the release tag to its commit:
11
13
  *
12
14
  * gh api repos/actions/checkout/commits/v7.0.1 --jq .sha
13
- *
14
- * Keep `major` on a version whose action runs on a Node runtime GitHub still
15
- * supports.
16
15
  */
17
16
 
17
+ import { ACTION_PINS as CORE_PINS, type ActionPin as CorePin } from "@intentius/chant/action-pins";
18
+
18
19
  export interface ActionPin {
19
- /** The major tag composites emit by default, such as `v7`. */
20
+ /** The major tag `pin: "tag"` emits, such as `v7`. */
20
21
  major: string;
21
22
  /** The release the SHA belongs to, written as the pin's comment. */
22
23
  version: string;
@@ -24,42 +25,53 @@ export interface ActionPin {
24
25
  sha: string;
25
26
  }
26
27
 
27
- export const ACTION_PINS = {
28
- "actions/checkout": {
29
- major: "v7",
30
- version: "v7.0.1",
31
- sha: "3d3c42e5aac5ba805825da76410c181273ba90b1",
32
- },
33
- "actions/setup-node": {
34
- major: "v7",
35
- version: "v7.0.0",
36
- sha: "820762786026740c76f36085b0efc47a31fe5020",
37
- },
38
- } as const satisfies Record<string, ActionPin>;
28
+ const SLUGS = [
29
+ "actions/checkout",
30
+ "actions/setup-node",
31
+ "actions/setup-go",
32
+ "actions/setup-python",
33
+ "actions/cache",
34
+ "actions/upload-artifact",
35
+ "actions/download-artifact",
36
+ "oven-sh/setup-bun",
37
+ "golangci/golangci-lint-action",
38
+ "docker/login-action",
39
+ "docker/setup-buildx-action",
40
+ "docker/metadata-action",
41
+ "docker/build-push-action",
42
+ ] as const;
43
+
44
+ export type PinnedAction = (typeof SLUGS)[number];
45
+
46
+ /** The newest row of core's table for `slug`. */
47
+ function newest(slug: string): ActionPin {
48
+ const rows = (Object.values(CORE_PINS) as CorePin[]).filter((p) => p.slug === slug);
49
+ if (rows.length === 0) throw new Error(`action-pins: core's table has no row for ${slug}`);
50
+ const row = rows.reduce((a, b) => (Number(b.major.slice(1)) > Number(a.major.slice(1)) ? b : a));
51
+ return { major: row.major, version: row.tag, sha: row.sha };
52
+ }
39
53
 
40
- export type PinnedAction = keyof typeof ACTION_PINS;
54
+ export const ACTION_PINS = Object.fromEntries(SLUGS.map((s) => [s, newest(s)])) as Record<PinnedAction, ActionPin>;
41
55
 
42
56
  /**
43
- * How a composite refers to its action: `"tag"` emits the major tag
44
- * (`actions/checkout@v7`), `"sha"` emits the pinned commit with its version
45
- * as a comment (`actions/checkout@3d3c…90b1 # v7.0.1`).
57
+ * How a composite refers to its action: `"sha"` (the default) emits the pinned
58
+ * commit with its version as a comment (`actions/checkout@3d3c…90b1 # v7.0.1`),
59
+ * `"tag"` emits the major tag (`actions/checkout@v7`).
46
60
  */
47
61
  export type ActionPinMode = "tag" | "sha";
48
62
 
49
63
  /** The `uses:` value for a pinned action. */
50
- export function actionRef(slug: PinnedAction, pin: ActionPinMode = "tag"): string {
51
- const entry: ActionPin = ACTION_PINS[slug];
64
+ export function actionRef(slug: PinnedAction, pin: ActionPinMode = "sha"): string {
65
+ const entry = ACTION_PINS[slug];
52
66
  return pin === "sha" ? `${slug}@${entry.sha} # ${entry.version}` : `${slug}@${entry.major}`;
53
67
  }
54
68
 
55
69
  /** The pin table entry for an action slug, if the lexicon maintains one. */
56
70
  export function actionPin(slug: string): ActionPin | undefined {
57
- return Object.prototype.hasOwnProperty.call(ACTION_PINS, slug)
58
- ? ACTION_PINS[slug as PinnedAction]
59
- : undefined;
71
+ return Object.prototype.hasOwnProperty.call(ACTION_PINS, slug) ? ACTION_PINS[slug as PinnedAction] : undefined;
60
72
  }
61
73
 
62
- const COMPOSITE_FOR: Record<PinnedAction, string> = {
74
+ const COMPOSITE_FOR: Partial<Record<PinnedAction, string>> = {
63
75
  "actions/checkout": "Checkout",
64
76
  "actions/setup-node": "SetupNode",
65
77
  };
@@ -71,5 +83,7 @@ const COMPOSITE_FOR: Record<PinnedAction, string> = {
71
83
  export function pinFixHint(slug: string): string {
72
84
  if (!actionPin(slug)) return "";
73
85
  const pinned = slug as PinnedAction;
74
- return ` Use \`uses: ${actionRef(pinned, "sha")}\`, which ${COMPOSITE_FOR[pinned]}({ pin: "sha" }) emits.`;
86
+ const composite = COMPOSITE_FOR[pinned];
87
+ const how = composite ? `, which ${composite}({ pin: "sha" }) emits` : "";
88
+ return ` Use \`uses: ${actionRef(pinned, "sha")}\`${how}.`;
75
89
  }
@@ -71,7 +71,6 @@ jobs:
71
71
  env:
72
72
  BASE_SHA: '${{ github.event.pull_request.base.sha }}'
73
73
  PR_NUMBER: '${{ github.event.pull_request.number }}'
74
- CHANT_RUNNER_KEY: '${{ secrets.CHANT_RUNNER_KEY }}'
75
74
  run: |
76
75
  if [ -z "${CHANT_NO_FORGE_TOKEN:-}" ] && [ "${0#*/}" != "$0" ] && [ -f "$0" ] && ! { [ "${0##*/}" = sh ] || [ "${0##*/}" = bash ] || [ "${0##*/}" = dash ]; } && command -v env >/dev/null 2>&1 && command -v sh >/dev/null 2>&1; then exec env -u CHANT_FORGE_TOKEN -u CHANT_GITHUB_TOKEN -u CHANT_FORGEJO_TOKEN -u CHANT_GITLAB_TOKEN -u CHANT_CHECKOUT_TOKEN -u GITHUB_TOKEN -u GH_TOKEN -u FORGEJO_TOKEN -u GITEA_TOKEN -u GITLAB_TOKEN -u CI_JOB_TOKEN -u ACTIONS_RUNTIME_TOKEN CHANT_NO_FORGE_TOKEN=1 sh -e "$0"; fi; unset CHANT_FORGE_TOKEN CHANT_GITHUB_TOKEN CHANT_FORGEJO_TOKEN CHANT_GITLAB_TOKEN CHANT_CHECKOUT_TOKEN GITHUB_TOKEN GH_TOKEN FORGEJO_TOKEN GITEA_TOKEN GITLAB_TOKEN CI_JOB_TOKEN ACTIONS_RUNTIME_TOKEN
77
76
  chant_report="$PWD/.chant/pr"
@@ -91,7 +90,7 @@ jobs:
91
90
  statuses: write
92
91
  steps:
93
92
  - name: Check out the target branch's commit
94
- uses: actions/checkout@v7
93
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
95
94
  with:
96
95
  ref: '${{ github.event.pull_request.base.sha }}'
97
96
  - name: Take the plan report from the plan job
@@ -102,7 +101,7 @@ jobs:
102
101
  END_OF_REPORT
103
102
  - name: Keep the plan report
104
103
  if: always()
105
- uses: actions/upload-artifact@v4
104
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
106
105
  with:
107
106
  name: chant-pr-plan
108
107
  path: .chant/pr
@@ -128,7 +127,7 @@ jobs:
128
127
  pull-requests: write
129
128
  statuses: write
130
129
  steps:
131
- - uses: actions/checkout@v7
130
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
132
131
  with:
133
132
  fetch-depth: 0
134
133
  - run: command -v tofu >/dev/null 2>&1 || (curl -fsSL https://get.opentofu.org/install-opentofu.sh -o /tmp/install-opentofu.sh && sh /tmp/install-opentofu.sh --install-method standalone)
@@ -146,7 +145,7 @@ jobs:
146
145
  chant ci run record --in-place --base "$BASE_SHA" --env prod --gate pr-apply --forge github
147
146
  - name: Keep the record report
148
147
  if: always()
149
- uses: actions/upload-artifact@v4
148
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
150
149
  with:
151
150
  name: chant-pr-record
152
151
  path: .chant/pr
@@ -164,7 +163,7 @@ jobs:
164
163
  pull-requests: write
165
164
  statuses: write
166
165
  steps:
167
- - uses: actions/checkout@v7
166
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
168
167
  with:
169
168
  fetch-depth: 0
170
169
  - run: command -v tofu >/dev/null 2>&1 || (curl -fsSL https://get.opentofu.org/install-opentofu.sh -o /tmp/install-opentofu.sh && sh /tmp/install-opentofu.sh --install-method standalone)
@@ -173,7 +172,7 @@ jobs:
173
172
  - name: Lint the project
174
173
  run: chant lint
175
174
  - name: Restore the record of an earlier attempt at this commit
176
- uses: actions/cache/restore@v4
175
+ uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
177
176
  with:
178
177
  path: .chant/pr-resume/pr-apply.json
179
178
  key: chant-apply-prod-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
@@ -187,13 +186,13 @@ jobs:
187
186
  chant ci run apply --in-place --env prod --gate pr-apply --forge github
188
187
  - name: Keep the record for a re-run
189
188
  if: always()
190
- uses: actions/cache/save@v4
189
+ uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
191
190
  with:
192
191
  path: .chant/pr-resume/pr-apply.json
193
192
  key: chant-apply-prod-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
194
193
  - name: Keep the apply report
195
194
  if: always()
196
- uses: actions/upload-artifact@v4
195
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
197
196
  with:
198
197
  name: chant-pr-apply
199
198
  path: .chant/pr
@@ -57,7 +57,6 @@ jobs:
57
57
  env:
58
58
  BASE_SHA: '${{ github.event.pull_request.base.sha }}'
59
59
  PR_NUMBER: '${{ github.event.pull_request.number }}'
60
- CHANT_RUNNER_KEY: '${{ secrets.CHANT_RUNNER_KEY }}'
61
60
  run: |
62
61
  if [ -z "${CHANT_NO_FORGE_TOKEN:-}" ] && [ "${0#*/}" != "$0" ] && [ -f "$0" ] && ! { [ "${0##*/}" = sh ] || [ "${0##*/}" = bash ] || [ "${0##*/}" = dash ]; } && command -v env >/dev/null 2>&1 && command -v sh >/dev/null 2>&1; then exec env -u CHANT_FORGE_TOKEN -u CHANT_GITHUB_TOKEN -u CHANT_FORGEJO_TOKEN -u CHANT_GITLAB_TOKEN -u CHANT_CHECKOUT_TOKEN -u GITHUB_TOKEN -u GH_TOKEN -u FORGEJO_TOKEN -u GITEA_TOKEN -u GITLAB_TOKEN -u CI_JOB_TOKEN -u ACTIONS_RUNTIME_TOKEN CHANT_NO_FORGE_TOKEN=1 sh -e "$0"; fi; unset CHANT_FORGE_TOKEN CHANT_GITHUB_TOKEN CHANT_FORGEJO_TOKEN CHANT_GITLAB_TOKEN CHANT_CHECKOUT_TOKEN GITHUB_TOKEN GH_TOKEN FORGEJO_TOKEN GITEA_TOKEN GITLAB_TOKEN CI_JOB_TOKEN ACTIONS_RUNTIME_TOKEN
63
62
  chant_report="$PWD/.chant/pr"
@@ -77,7 +76,7 @@ jobs:
77
76
  statuses: write
78
77
  steps:
79
78
  - name: Check out the target branch's commit
80
- uses: actions/checkout@v7
79
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
81
80
  with:
82
81
  ref: '${{ github.event.pull_request.base.sha }}'
83
82
  - name: Take the plan report from the plan job
@@ -88,7 +87,7 @@ jobs:
88
87
  END_OF_REPORT
89
88
  - name: Keep the plan report
90
89
  if: always()
91
- uses: actions/upload-artifact@v4
90
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
92
91
  with:
93
92
  name: chant-pr-plan
94
93
  path: .chant/pr
@@ -114,7 +113,7 @@ jobs:
114
113
  pull-requests: write
115
114
  statuses: write
116
115
  steps:
117
- - uses: actions/checkout@v7
116
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
118
117
  with:
119
118
  fetch-depth: 0
120
119
  - run: command -v tofu >/dev/null 2>&1 || (curl -fsSL https://get.opentofu.org/install-opentofu.sh -o /tmp/install-opentofu.sh && sh /tmp/install-opentofu.sh --install-method standalone)
@@ -128,7 +127,7 @@ jobs:
128
127
  chant ci run record --in-place --base "$BASE_SHA" --env prod --gate pr-apply --forge github
129
128
  - name: Keep the record report
130
129
  if: always()
131
- uses: actions/upload-artifact@v4
130
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
132
131
  with:
133
132
  name: chant-pr-record
134
133
  path: .chant/pr
@@ -63,7 +63,6 @@ jobs:
63
63
  env:
64
64
  BASE_SHA: '${{ github.event.pull_request.base.sha }}'
65
65
  PR_NUMBER: '${{ github.event.pull_request.number }}'
66
- CHANT_RUNNER_KEY: '${{ secrets.CHANT_RUNNER_KEY }}'
67
66
  run: |
68
67
  if [ -z "${CHANT_NO_FORGE_TOKEN:-}" ] && [ "${0#*/}" != "$0" ] && [ -f "$0" ] && ! { [ "${0##*/}" = sh ] || [ "${0##*/}" = bash ] || [ "${0##*/}" = dash ]; } && command -v env >/dev/null 2>&1 && command -v sh >/dev/null 2>&1; then exec env -u CHANT_FORGE_TOKEN -u CHANT_GITHUB_TOKEN -u CHANT_FORGEJO_TOKEN -u CHANT_GITLAB_TOKEN -u CHANT_CHECKOUT_TOKEN -u GITHUB_TOKEN -u GH_TOKEN -u FORGEJO_TOKEN -u GITEA_TOKEN -u GITLAB_TOKEN -u CI_JOB_TOKEN -u ACTIONS_RUNTIME_TOKEN CHANT_NO_FORGE_TOKEN=1 sh -e "$0"; fi; unset CHANT_FORGE_TOKEN CHANT_GITHUB_TOKEN CHANT_FORGEJO_TOKEN CHANT_GITLAB_TOKEN CHANT_CHECKOUT_TOKEN GITHUB_TOKEN GH_TOKEN FORGEJO_TOKEN GITEA_TOKEN GITLAB_TOKEN CI_JOB_TOKEN ACTIONS_RUNTIME_TOKEN
69
68
  chant_report="$PWD/.chant/pr"
@@ -83,7 +82,7 @@ jobs:
83
82
  statuses: write
84
83
  steps:
85
84
  - name: Check out the target branch's commit
86
- uses: actions/checkout@v7
85
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
87
86
  with:
88
87
  ref: '${{ github.event.pull_request.base.sha }}'
89
88
  - name: Take the plan report from the plan job
@@ -94,7 +93,7 @@ jobs:
94
93
  END_OF_REPORT
95
94
  - name: Keep the plan report
96
95
  if: always()
97
- uses: actions/upload-artifact@v4
96
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
98
97
  with:
99
98
  name: chant-pr-plan
100
99
  path: .chant/pr
@@ -120,7 +119,7 @@ jobs:
120
119
  pull-requests: write
121
120
  statuses: write
122
121
  steps:
123
- - uses: actions/checkout@v7
122
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
124
123
  with:
125
124
  fetch-depth: 0
126
125
  - run: command -v tofu >/dev/null 2>&1 || (curl -fsSL https://get.opentofu.org/install-opentofu.sh -o /tmp/install-opentofu.sh && sh /tmp/install-opentofu.sh --install-method standalone)
@@ -134,7 +133,7 @@ jobs:
134
133
  chant ci run record --in-place --base "$BASE_SHA" --env prod --gate pr-apply --forge github
135
134
  - name: Keep the record report
136
135
  if: always()
137
- uses: actions/upload-artifact@v4
136
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
138
137
  with:
139
138
  name: chant-pr-record
140
139
  path: .chant/pr
@@ -154,12 +153,12 @@ jobs:
154
153
  outputs:
155
154
  green-sha: '${{ steps.apply.outputs.green-sha }}'
156
155
  steps:
157
- - uses: actions/checkout@v7
156
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
158
157
  with:
159
158
  fetch-depth: 0
160
159
  - run: command -v tofu >/dev/null 2>&1 || (curl -fsSL https://get.opentofu.org/install-opentofu.sh -o /tmp/install-opentofu.sh && sh /tmp/install-opentofu.sh --install-method standalone)
161
160
  - name: Restore the newest record of this commit's apply
162
- uses: actions/cache/restore@v4
161
+ uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
163
162
  with:
164
163
  path: .chant/pr-resume/pr-apply.json
165
164
  key: chant-apply-prod-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}-wave-1
@@ -175,13 +174,13 @@ jobs:
175
174
  chant ci run apply --in-place --env prod --gate pr-apply --forge github --wave-gate release --wave 1
176
175
  - name: Keep the record for the next wave and a re-run
177
176
  if: always()
178
- uses: actions/cache/save@v4
177
+ uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
179
178
  with:
180
179
  path: .chant/pr-resume/pr-apply.json
181
180
  key: chant-apply-prod-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}-wave-1
182
181
  - name: Keep the wave 1 apply report
183
182
  if: always()
184
- uses: actions/upload-artifact@v4
183
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
185
184
  with:
186
185
  name: chant-pr-apply-wave-1
187
186
  path: .chant/pr
@@ -203,12 +202,12 @@ jobs:
203
202
  outputs:
204
203
  green-sha: '${{ steps.apply.outputs.green-sha }}'
205
204
  steps:
206
- - uses: actions/checkout@v7
205
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
207
206
  with:
208
207
  fetch-depth: 0
209
208
  - run: command -v tofu >/dev/null 2>&1 || (curl -fsSL https://get.opentofu.org/install-opentofu.sh -o /tmp/install-opentofu.sh && sh /tmp/install-opentofu.sh --install-method standalone)
210
209
  - name: Restore the newest record of this commit's apply
211
- uses: actions/cache/restore@v4
210
+ uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
212
211
  with:
213
212
  path: .chant/pr-resume/pr-apply.json
214
213
  key: chant-apply-prod-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}-wave-2
@@ -225,13 +224,13 @@ jobs:
225
224
  chant ci run apply --in-place --env prod --gate pr-apply --forge github --wave-gate release --wave 2
226
225
  - name: Keep the record for the next wave and a re-run
227
226
  if: always()
228
- uses: actions/cache/save@v4
227
+ uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
229
228
  with:
230
229
  path: .chant/pr-resume/pr-apply.json
231
230
  key: chant-apply-prod-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}-wave-2
232
231
  - name: Keep the wave 2 apply report
233
232
  if: always()
234
- uses: actions/upload-artifact@v4
233
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
235
234
  with:
236
235
  name: chant-pr-apply-wave-2
237
236
  path: .chant/pr
@@ -253,12 +252,12 @@ jobs:
253
252
  outputs:
254
253
  green-sha: '${{ steps.apply.outputs.green-sha }}'
255
254
  steps:
256
- - uses: actions/checkout@v7
255
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
257
256
  with:
258
257
  fetch-depth: 0
259
258
  - run: command -v tofu >/dev/null 2>&1 || (curl -fsSL https://get.opentofu.org/install-opentofu.sh -o /tmp/install-opentofu.sh && sh /tmp/install-opentofu.sh --install-method standalone)
260
259
  - name: Restore the newest record of this commit's apply
261
- uses: actions/cache/restore@v4
260
+ uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
262
261
  with:
263
262
  path: .chant/pr-resume/pr-apply.json
264
263
  key: chant-apply-prod-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}-wave-3
@@ -275,13 +274,13 @@ jobs:
275
274
  chant ci run apply --in-place --env prod --gate pr-apply --forge github --wave-gate release --wave 3
276
275
  - name: Keep the record for the next wave and a re-run
277
276
  if: always()
278
- uses: actions/cache/save@v4
277
+ uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
279
278
  with:
280
279
  path: .chant/pr-resume/pr-apply.json
281
280
  key: chant-apply-prod-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}-wave-3
282
281
  - name: Keep the wave 3 apply report
283
282
  if: always()
284
- uses: actions/upload-artifact@v4
283
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
285
284
  with:
286
285
  name: chant-pr-apply-wave-3
287
286
  path: .chant/pr
@@ -63,7 +63,6 @@ jobs:
63
63
  env:
64
64
  BASE_SHA: '${{ github.event.pull_request.base.sha }}'
65
65
  PR_NUMBER: '${{ github.event.pull_request.number }}'
66
- CHANT_RUNNER_KEY: '${{ secrets.CHANT_RUNNER_KEY }}'
67
66
  run: |
68
67
  if [ -z "${CHANT_NO_FORGE_TOKEN:-}" ] && [ "${0#*/}" != "$0" ] && [ -f "$0" ] && ! { [ "${0##*/}" = sh ] || [ "${0##*/}" = bash ] || [ "${0##*/}" = dash ]; } && command -v env >/dev/null 2>&1 && command -v sh >/dev/null 2>&1; then exec env -u CHANT_FORGE_TOKEN -u CHANT_GITHUB_TOKEN -u CHANT_FORGEJO_TOKEN -u CHANT_GITLAB_TOKEN -u CHANT_CHECKOUT_TOKEN -u GITHUB_TOKEN -u GH_TOKEN -u FORGEJO_TOKEN -u GITEA_TOKEN -u GITLAB_TOKEN -u CI_JOB_TOKEN -u ACTIONS_RUNTIME_TOKEN CHANT_NO_FORGE_TOKEN=1 sh -e "$0"; fi; unset CHANT_FORGE_TOKEN CHANT_GITHUB_TOKEN CHANT_FORGEJO_TOKEN CHANT_GITLAB_TOKEN CHANT_CHECKOUT_TOKEN GITHUB_TOKEN GH_TOKEN FORGEJO_TOKEN GITEA_TOKEN GITLAB_TOKEN CI_JOB_TOKEN ACTIONS_RUNTIME_TOKEN
69
68
  chant_report="$PWD/.chant/pr"
@@ -83,7 +82,7 @@ jobs:
83
82
  statuses: write
84
83
  steps:
85
84
  - name: Check out the target branch's commit
86
- uses: actions/checkout@v7
85
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
87
86
  with:
88
87
  ref: '${{ github.event.pull_request.base.sha }}'
89
88
  - name: Take the plan report from the plan job
@@ -94,7 +93,7 @@ jobs:
94
93
  END_OF_REPORT
95
94
  - name: Keep the plan report
96
95
  if: always()
97
- uses: actions/upload-artifact@v4
96
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
98
97
  with:
99
98
  name: chant-pr-plan
100
99
  path: .chant/pr
@@ -120,7 +119,7 @@ jobs:
120
119
  pull-requests: write
121
120
  statuses: write
122
121
  steps:
123
- - uses: actions/checkout@v7
122
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
124
123
  with:
125
124
  fetch-depth: 0
126
125
  - run: command -v tofu >/dev/null 2>&1 || (curl -fsSL https://get.opentofu.org/install-opentofu.sh -o /tmp/install-opentofu.sh && sh /tmp/install-opentofu.sh --install-method standalone)
@@ -134,7 +133,7 @@ jobs:
134
133
  chant ci run record --in-place --base "$BASE_SHA" --env prod --gate pr-apply --forge github
135
134
  - name: Keep the record report
136
135
  if: always()
137
- uses: actions/upload-artifact@v4
136
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
138
137
  with:
139
138
  name: chant-pr-record
140
139
  path: .chant/pr
@@ -152,12 +151,12 @@ jobs:
152
151
  pull-requests: write
153
152
  statuses: write
154
153
  steps:
155
- - uses: actions/checkout@v7
154
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
156
155
  with:
157
156
  fetch-depth: 0
158
157
  - run: command -v tofu >/dev/null 2>&1 || (curl -fsSL https://get.opentofu.org/install-opentofu.sh -o /tmp/install-opentofu.sh && sh /tmp/install-opentofu.sh --install-method standalone)
159
158
  - name: Restore the record of an earlier attempt at this commit
160
- uses: actions/cache/restore@v4
159
+ uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
161
160
  with:
162
161
  path: .chant/pr-resume/pr-apply.json
163
162
  key: chant-apply-prod-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
@@ -171,13 +170,13 @@ jobs:
171
170
  chant ci run apply --in-place --env prod --gate pr-apply --forge github
172
171
  - name: Keep the record for a re-run
173
172
  if: always()
174
- uses: actions/cache/save@v4
173
+ uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
175
174
  with:
176
175
  path: .chant/pr-resume/pr-apply.json
177
176
  key: chant-apply-prod-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
178
177
  - name: Keep the apply report
179
178
  if: always()
180
- uses: actions/upload-artifact@v4
179
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
181
180
  with:
182
181
  name: chant-pr-apply
183
182
  path: .chant/pr
@@ -20,15 +20,25 @@ jobs:
20
20
  - dev
21
21
  container: node:22
22
22
  steps:
23
- - uses: actions/checkout@v7
23
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
24
24
  with:
25
25
  fetch-depth: 0
26
26
  - name: Plan, gate and apply wave 1 (dev)
27
27
  run: chant run wave --spec waves.json --wave 1
28
+ - name: Keep the job's outcome
29
+ if: always()
30
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
31
+ with:
32
+ name: migrations-wave-1-dev-outcome
33
+ path: .chant/op-waves/migrations/outcomes/outcome-wave-1.json
34
+ if-no-files-found: ignore
35
+ include-hidden-files: true
36
+ overwrite: true
28
37
  wave-2-prod-decide:
29
38
  runs-on: plan
30
39
  needs:
31
40
  - wave-1-dev
41
+ if: '!cancelled()'
32
42
  container: node:22
33
43
  permissions:
34
44
  contents: write
@@ -37,20 +47,33 @@ jobs:
37
47
  STAGE: apply
38
48
  PLAN_TOKEN_AUDIENCE: plan.example
39
49
  steps:
40
- - uses: actions/checkout@v7
50
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
41
51
  with:
42
52
  fetch-depth: 0
53
+ - name: Download the earlier jobs' outcomes
54
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
55
+ with:
56
+ path: .chant/op-waves/migrations/outcomes
43
57
  - name: Plan wave 2 (prod) and decide its gate
44
58
  run: chant run wave --spec waves.json --wave 2 --decide
45
59
  - name: Keep wave 2's decision
46
60
  if: always()
47
- uses: actions/upload-artifact@v4
61
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
48
62
  with:
49
63
  name: migrations-wave-2-decision
50
64
  path: .chant/op-waves/migrations/wave-2.json
51
65
  if-no-files-found: ignore
52
66
  include-hidden-files: true
53
67
  overwrite: true
68
+ - name: Keep the job's outcome
69
+ if: always()
70
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
71
+ with:
72
+ name: migrations-wave-2-prod-decide-outcome
73
+ path: .chant/op-waves/migrations/outcomes/outcome-wave-2.json
74
+ if-no-files-found: ignore
75
+ include-hidden-files: true
76
+ overwrite: true
54
77
  wave-2-prod-us-share-1:
55
78
  runs-on:
56
79
  group: prod-apply
@@ -69,17 +92,30 @@ jobs:
69
92
  REGION: us
70
93
  CLOUD_TOKEN_AUDIENCE: us.example
71
94
  steps:
72
- - uses: actions/checkout@v7
95
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
73
96
  with:
74
97
  fetch-depth: 0
75
98
  - name: Download wave 2's decision
76
- uses: actions/download-artifact@v4
99
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
77
100
  with:
78
101
  name: migrations-wave-2-decision
79
102
  path: .chant/op-waves/migrations
103
+ - name: Download the earlier jobs' outcomes
104
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
105
+ with:
106
+ path: .chant/op-waves/migrations/outcomes
80
107
  - run: echo us
81
108
  - name: Apply share 1 of job group us of wave 2 (prod)
82
109
  run: chant run wave --spec waves.json --wave 2 --group us --share 1
110
+ - name: Keep the job's outcome
111
+ if: always()
112
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
113
+ with:
114
+ name: migrations-wave-2-prod-us-share-1-outcome
115
+ path: .chant/op-waves/migrations/outcomes/outcome-wave-2-group-us-share-1.json
116
+ if-no-files-found: ignore
117
+ include-hidden-files: true
118
+ overwrite: true
83
119
  wave-2-prod-us-share-2:
84
120
  runs-on:
85
121
  group: prod-apply
@@ -98,17 +134,30 @@ jobs:
98
134
  REGION: us
99
135
  CLOUD_TOKEN_AUDIENCE: us.example
100
136
  steps:
101
- - uses: actions/checkout@v7
137
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
102
138
  with:
103
139
  fetch-depth: 0
104
140
  - name: Download wave 2's decision
105
- uses: actions/download-artifact@v4
141
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
106
142
  with:
107
143
  name: migrations-wave-2-decision
108
144
  path: .chant/op-waves/migrations
145
+ - name: Download the earlier jobs' outcomes
146
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
147
+ with:
148
+ path: .chant/op-waves/migrations/outcomes
109
149
  - run: echo us
110
150
  - name: Apply share 2 of job group us of wave 2 (prod)
111
151
  run: chant run wave --spec waves.json --wave 2 --group us --share 2
152
+ - name: Keep the job's outcome
153
+ if: always()
154
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
155
+ with:
156
+ name: migrations-wave-2-prod-us-share-2-outcome
157
+ path: .chant/op-waves/migrations/outcomes/outcome-wave-2-group-us-share-2.json
158
+ if-no-files-found: ignore
159
+ include-hidden-files: true
160
+ overwrite: true
112
161
  wave-2-prod-eu:
113
162
  runs-on: eu-apply
114
163
  needs:
@@ -123,13 +172,26 @@ jobs:
123
172
  STAGE: apply
124
173
  PLAN_TOKEN_AUDIENCE: plan.example
125
174
  steps:
126
- - uses: actions/checkout@v7
175
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
127
176
  with:
128
177
  fetch-depth: 0
129
178
  - name: Download wave 2's decision
130
- uses: actions/download-artifact@v4
179
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
131
180
  with:
132
181
  name: migrations-wave-2-decision
133
182
  path: .chant/op-waves/migrations
183
+ - name: Download the earlier jobs' outcomes
184
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
185
+ with:
186
+ path: .chant/op-waves/migrations/outcomes
134
187
  - name: Apply job group eu of wave 2 (prod)
135
188
  run: chant run wave --spec waves.json --wave 2 --group eu
189
+ - name: Keep the job's outcome
190
+ if: always()
191
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
192
+ with:
193
+ name: migrations-wave-2-prod-eu-outcome
194
+ path: .chant/op-waves/migrations/outcomes/outcome-wave-2-group-eu.json
195
+ if-no-files-found: ignore
196
+ include-hidden-files: true
197
+ overwrite: true
@@ -11,15 +11,18 @@
11
11
  import { emitYAML, emitYAMLEntry } from "@intentius/chant/yaml";
12
12
  import { BUILD_REQUEST_TAGS, GITHUB_JOB_TOKEN, pushBranches } from "@intentius/chant/ci-jobs";
13
13
  import type { OpTrigger } from "@intentius/chant/lexicon";
14
- import { actionRef } from "../action-pins";
14
+ import { ACTION_PINS as PINS, tagComments, usesRef } from "@intentius/chant/action-pins";
15
15
 
16
16
  /** The artifact actions every generated job uses, at the major the generators have always pinned. */
17
- export const UPLOAD_ARTIFACT = "actions/upload-artifact@v4";
18
- export const DOWNLOAD_ARTIFACT = "actions/download-artifact@v4";
17
+ export const UPLOAD_ARTIFACT = usesRef(PINS.uploadArtifact4);
18
+ export const DOWNLOAD_ARTIFACT = usesRef(PINS.downloadArtifact4);
19
+ export const CHECKOUT = usesRef(PINS.checkout7);
20
+ export const CACHE_RESTORE = usesRef(PINS.cacheRestore4);
21
+ export const CACHE_SAVE = usesRef(PINS.cacheSave4);
19
22
 
20
23
  /** The checkout step; `fullHistory` fetches every commit, for a job that reads the base commit or measures a change with git. */
21
24
  export function checkoutStep(fullHistory = false): Record<string, unknown> {
22
- return fullHistory ? { uses: actionRef("actions/checkout"), with: { "fetch-depth": 0 } } : { uses: actionRef("actions/checkout") };
25
+ return fullHistory ? { uses: CHECKOUT, with: { "fetch-depth": 0 } } : { uses: CHECKOUT };
23
26
  }
24
27
 
25
28
  /** One `run:` step per line, so each line is its own step in the log. */
@@ -135,5 +138,5 @@ export function emitWorkflowYAML(doc: GithubWorkflowDoc): string {
135
138
  if (doc.concurrency) sections.push(emitYAMLEntry("concurrency", doc.concurrency));
136
139
  if (doc.permissions && Object.keys(doc.permissions).length > 0) sections.push(emitYAMLEntry("permissions", doc.permissions));
137
140
  sections.push(emitYAMLEntry("jobs", doc.jobsDoc));
138
- return sections.join("\n\n") + "\n";
141
+ return tagComments(sections.join("\n\n") + "\n");
139
142
  }