You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3b57545
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(sections)!: environments plan through the secrets and variables engines; the sealing key is read at apply
The secrets engine reads the scope's sealing key from the first sealed PUT's thunk (once per scope), so the four repo families declare the key endpoint execution-phase and environments' nested secrets share the engine; the variables engine serves environments' nested variables too. Both engines take the scope's home noun and change-line suffix and render through the shared prose helpers; the variables engine proves every payload plain. The per-list duplicate rejecters in environments give way to rejectDuplicates with a resource noun.
BREAKING CHANGE: check mode no longer reads the sealing key (a malformed key fails the first PUT at apply); the environment secret and variable lines use the engines' wording. docs/upgrading/v2-to-v3.md sections 10-11.
Copy file name to clipboardExpand all lines: docs/upgrading/v2-to-v3.md
+24-1Lines changed: 24 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ order: 20
4
4
5
5
# Upgrading from v2 to v3
6
6
7
-
Fifteen breaks (the ninth is for library consumers). One is silent (the fallback), so run `mode: check` before the first v3 apply. The changelog entry for 3.0.0 will carry the release-please footers in the [CHANGELOG](https://github.com/Vivswan/github-settings-as-code/blob/main/CHANGELOG.md).
7
+
Seventeen breaks (the ninth is for library consumers). One is silent (the fallback), so run `mode: check` before the first v3 apply. The changelog entry for 3.0.0 will carry the release-please footers in the [CHANGELOG](https://github.com/Vivswan/github-settings-as-code/blob/main/CHANGELOG.md).
8
8
9
9
| Break | v2 | v3 | What the old form does now |
10
10
|---|---|---|---|
@@ -23,6 +23,8 @@ Fifteen breaks (the ninth is for library consumers). One is silent (the fallback
23
23
| One wording per concept in drift lines and notes | Per-section spellings of "cannot verify", "left out", and field drift; quoted webhook labels | One template each on the converted sites | Only a grep over the output notices; [section 13](#13-one-wording-per-concept-in-drift-lines-and-notes)|
24
24
| Webhooks manage web hooks only | A service hook was matched and deleted like any other | A service hook or url-less hook is outside the section | It is left alone and noted by snapshot; [section 14](#14-webhooks-manage-web-hooks-only)|
25
25
| A ruleset without `source_type` is repository-owned | Kept with a note under `_undeclared: delete`| Deleted like any other undeclared repository ruleset |[section 15](#15-a-ruleset-without-source_type-is-repository-owned)|
26
+
| The sealing key is read at apply time | Check mode read `GET .../secrets/public-key` and failed on a malformed key | The first sealed PUT reads it at apply | Check mode issues one request fewer per secret family; a malformed key fails at apply; [section 16](#16-the-sealing-key-is-read-at-apply-time)|
27
+
| Environment secrets and variables plan through the shared engines | Their own wording | The engines' wording | Only a grep over the output notices; [section 17](#17-environment-secrets-and-variables-plan-through-the-shared-engines)|
26
28
27
29
## 1. The defaults-file fallback
28
30
@@ -241,6 +243,27 @@ The other cannot-verify and omission notes (interaction_limits, teams, collabora
241
243
242
244
v2 refused to delete an undeclared ruleset whose list entry lacked `source_type`, with a note. v3 reads a missing `source_type` as `Repository`, the only kind the repository endpoints can write, so `_undeclared: delete` deletes it.
243
245
246
+
## 16. The sealing key is read at apply time
247
+
248
+
Every secret family (`actions_secrets`, `dependabot_secrets`, `codespaces_secrets`, `agents_secrets`) now reads `GET .../secrets/public-key` from the first sealed PUT, as environment secrets always did.
249
+
250
+
- Check mode issues one request fewer per family and never touches the key endpoint.
251
+
- A malformed key fails the first PUT at apply, before its request leaves, where v2 failed the plan in check mode too.
252
+
- The cannot-verify note carries the section label and the shared template: `actions_secrets: Actions secret values cannot be read back from GitHub, so check mode cannot verify them, only that each declared secret exists; apply re-seals and rewrites every declared value on every run`.
253
+
254
+
## 17. Environment secrets and variables plan through the shared engines
255
+
256
+
Their lines are the engines' lines now:
257
+
258
+
| Line | v2 | v3 |
259
+
|---|---|---|
260
+
| A kept undeclared variable | `variable "X" exists on environment "prod" but is not declared ...` | `variable "X" exists on the environment but is not declared ...` |
261
+
| A variable delete | `DELETED undeclared variable "X" from environment "prod"` | `DELETED undeclared variable "X" in environment "prod"` |
262
+
| Two entries naming one variable or secret | `environments: the "prod" entry declares variables that GitHub treats as the same variable ...` | `environments: the settings file declares entries that name the same variable of the "prod" environment: "a" and "A". Keep exactly one entry per resource` (branch policies and protection rules spell theirs the same way) |
263
+
| The secrets cannot-verify note | once per environment that exists | once per environment with declared secrets, the missing environment included, under the `environments[prod].secrets` label |
264
+
265
+
Repository variable operations (`actions_variables`, `agents_variables`) gain a describe line in failure prose (`creating Actions variable "X"`); nothing else moves.
266
+
244
267
## Order of operations
245
268
246
269
1. Rename any settings file whose path contains a comma, and rename `undeclared` to `_undeclared` in every settings file; the v2 line accepts the old spelling only, so do both together with the pin move.
"Actions secret values cannot be read back from GitHub, so check mode verifies only that each declared secret exists; apply re-seals and rewrites every declared value on each run";
23
+
"actions_secrets: Actions secret values cannot be read back from GitHub, so check mode cannot verify them, only that each declared secret exists; apply re-seals and rewrites every declared value on every run";
'environments: the "prod" entry declares variables that GitHub treats as the same variable (names are case-insensitive): "Region" and "REGION". Keep exactly one entry per variable',
295
+
'environments: the settings file declares entries that name the same variable of the "prod" environment: "Region" and "REGION". Keep exactly one entry per resource',
'variable "LEGACY" exists on environment "prod" but is not declared in the settings file; kept under "_undeclared: keep" - add it to the settings file to manage it, or set "_undeclared: delete" to have apply DELETE it',
311
+
'variable "LEGACY" exists on the environment but is not declared in the settings file; kept under "_undeclared: keep" - add it to the settings file to manage it, or set "_undeclared: delete" to have apply DELETE it',
'environments: the "prod" entry declares deployment branch policy "release/*" more than once. Keep exactly one entry per pattern',
812
+
'environments: the settings file declares entries that name the same deployment branch policy of the "prod" environment: "release/*" and "release/*". Keep exactly one entry per resource',
815
813
);
816
814
expect(api.calls).toEqual([]);
817
815
});
@@ -1137,14 +1135,22 @@ describe("environments missing-environment planning across the nested families",
"environments[prod]: missing - declared in the settings file but not on the repo; apply will create it",
1145
1143
createDrift,
1146
1144
]);
1147
-
expect(result.notes).toEqual([expectedNote]);
1145
+
// The secrets engine states once per scope that values never read back, beside the missing-environment note.
1146
+
expect(result.notes).toEqual(
1147
+
key==="secrets"
1148
+
? [
1149
+
expectedNote,
1150
+
"environments[prod].secrets: prod environment secret values cannot be read back from GitHub, so check mode cannot verify them, only that each declared secret exists; apply re-seals and rewrites every declared value on every run",
'environments: the "prod" entry declares the deployment protection rule App "deploy-gate" more than once. Keep exactly one entry per App',
1170
+
'environments: the settings file declares entries that name the same deployment protection rule App of the "prod" environment: "deploy-gate" and "deploy-gate". Keep exactly one entry per resource',
"prodenvironment secret values cannot be read back from GitHub, so check mode verifies only that each declared secret exists; apply re-seals and rewrites every declared value on each run",
1398
+
"environments[prod].secrets: prod environment secret values cannot be read back from GitHub, so check mode cannot verify them, only that each declared secret exists; apply re-seals and rewrites every declared value on every run",
1393
1399
'prod environment secret "KEPT" exists on the environment but is not declared in the '+
1394
1400
'settings file; kept under "_undeclared: keep" - add it to the settings file to manage '+
1395
1401
'it, or set "_undeclared: delete" to have apply DELETE it (a deleted secret\'s value is '+
[{role: "putSecret",drift: [],change: 'updated secret "NEW" in environment "staging"'}],
1472
1478
);
1473
1479
expect(second.notes).toEqual([
1474
-
"stagingenvironment secret values cannot be read back from GitHub, so check mode verifies only that each declared secret exists; apply re-seals and rewrites every declared value on each run",
1480
+
"environments[staging].secrets: staging environment secret values cannot be read back from GitHub, so check mode cannot verify them, only that each declared secret exists; apply re-seals and rewrites every declared value on every run",
0 commit comments