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 5a4488a
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+17-14Lines changed: 17 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ The reverse flow is:
48
48
| |-- reverse-config-label-sync.yml
49
49
| `-- validate-configs.yml
50
50
|-- config/
51
-
| |-- auto-pruned-labels.jsonc
51
+
| |-- github-default-labels.jsonc
52
52
| |-- labels.jsonc
53
53
| |-- properties.jsonc
54
54
| `-- repository-filter.jsonc
@@ -134,17 +134,19 @@ Example:
134
134
]
135
135
```
136
136
137
-
### `config/auto-pruned-labels.jsonc`
137
+
### `config/github-default-labels.jsonc`
138
138
139
-
This is the list of exact labels that should be removed from synced repositories when they are not managed by `config/labels.jsonc`.
139
+
This is the list of exact GitHub default labels that can be removed from synced repositories when they are not managed by `config/labels.jsonc`.
140
+
141
+
You will likely never need to modify this file unless GitHub changes the default labels it creates for new repositories.
140
142
141
143
Each entry must include:
142
144
143
145
-`name`
144
146
-`color`
145
147
-`description`
146
148
147
-
The starter file is prefilled with GitHub's default labels as exact specs:
149
+
The file is prefilled with GitHub's default labels as exact specs:
148
150
149
151
```jsonc
150
152
[
@@ -161,9 +163,9 @@ The starter file is prefilled with GitHub's default labels as exact specs:
161
163
]
162
164
```
163
165
164
-
`Org-Label-Sync` only deletes a configured auto-pruned label when the target repository label has the same name casing, color, and description. A custom label such as `Enhancement`, or an `enhancement` label with a different description or color, is not deleted by this file.
166
+
`Org-Label-Sync` only deletes an entry from this file when the `delete_github_default_labels` workflow checkbox is checked and the target repository label has the same name casing, color, and description. A custom label such as `Enhancement`, or an `enhancement` label with a different description or color, is not deleted as a GitHub default label.
165
167
166
-
Managed labels are the source of truth. If a label exists in `config/labels.jsonc`, it is created or updated on target repositories and is not deleted by `config/auto-pruned-labels.jsonc`, even when it has the same name as an auto-pruned default.
168
+
Managed labels are the source of truth. If a label exists in `config/labels.jsonc`, it is created or updated on target repositories and is not deleted by `config/github-default-labels.jsonc`, even when it has the same name as a GitHub default label.
167
169
168
170
### `config/repository-filter.jsonc`
169
171
@@ -216,7 +218,7 @@ What it does:
216
218
3. Resolves either the configured PAT or a GitHub App installation token
217
219
4. Reads the current labels on the source repository
218
220
5. Rewrites `config/labels.jsonc` so it exactly matches the source repository labels
219
-
6. Validates `config/auto-pruned-labels.jsonc` so exact default-delete specs remain well-formed
7. Commits and pushes the change if the config was updated
221
223
222
224
This workflow is the bridge between "the labels on this repo right now" and "the managed config we sync elsewhere."
@@ -244,7 +246,7 @@ Validation includes:
244
246
- duplicate whitelist and blacklist detection
245
247
- invalid colors
246
248
- invalid repo names
247
-
- exact auto-pruned label shape validation
249
+
- exact GitHub default label shape validation
248
250
- validation for the shared config used by `Remove-Labels`
249
251
250
252
### `Reverse-Config-Label-Sync`
@@ -264,7 +266,7 @@ What it does:
264
266
5. Resolves either the configured PAT or a GitHub App installation token
265
267
6. Validates the config again as a local guard
266
268
7. Creates or updates source repository labels from `config/labels.jsonc`
267
-
8. Deletes exact auto-pruned labels and any other source repository labels that are not in `config/labels.jsonc`
269
+
8. Deletes exact GitHub default labels and any other source repository labels that are not in `config/labels.jsonc`
268
270
269
271
This workflow is the bridge from "the managed config was changed by a person" back to "the source repository label settings should now match that config."
270
272
@@ -280,6 +282,7 @@ Inputs:
280
282
281
283
-`dry_run`: preview changes without applying repository label changes; when previewed changes exist, writes a fake changelog under `fake-changelogs/`
282
284
-`delete_missing`: delete extra labels that are not in `config/labels.jsonc`; unchecked keeps extra labels
285
+
-`delete_github_default_labels`: delete exact GitHub default labels from `config/github-default-labels.jsonc`; checked by default, unchecked keeps them
283
286
-`repositories`: comma-separated config override that runs exclusively on those repositories and ignores `repository-filter.jsonc`
284
287
285
288
What it does:
@@ -292,8 +295,8 @@ What it does:
292
295
6. Discovers repos in the configured organization
293
296
7. Applies `config/repository-filter.jsonc`, unless `repositories` was provided as a workflow dispatch config override
294
297
8. Creates or updates labels from `config/labels.jsonc`
295
-
9. Deletes labels that exactly match entries in `config/auto-pruned-labels.jsonc` unless that label name is managed by `config/labels.jsonc`
296
-
10. Optionally deletes any other unmanaged labels only when the `delete_missing` workflow checkbox is checked
298
+
9. Deletes labels that exactly match entries in `config/github-default-labels.jsonc` only when the `delete_github_default_labels` workflow checkbox is checked, unless that label name is managed by `config/labels.jsonc`
299
+
10. Optionally deletes any other unmanaged labels only when the `delete_missing` workflow checkbox is checked; exact GitHub default labels are reserved for `delete_github_default_labels`
297
300
11. If at least one target repo changed or would change, writes a changelog and commits it with `[skip ci]`; real runs write to `changelogs/YYYY-MM-DD/`, while preview runs write fake changelogs to `fake-changelogs/YYYY-MM-DD/` and do not apply repository changes
298
301
299
302
### `Remove-Labels`
@@ -333,7 +336,7 @@ Each changelog file is created only when a workflow actually changes, or in prev
333
336
334
337
- created labels
335
338
- updated labels, including changed fields
336
-
-configured auto-pruned labels that were deleted
339
+
-GitHub default labels that were deleted
337
340
- unmanaged labels that were deleted when delete-missing is enabled
338
341
339
342
`Remove-Labels` changelogs include:
@@ -376,7 +379,7 @@ The GitHub App installation must be granted access to this configuration reposit
376
379
1. Fork or clone this repository into the organization you want to manage.
377
380
2. Create either the PAT secret or the GitHub App secrets in the repo.
378
381
3. Update `config/properties.jsonc` for your org, repo, and auth mode.
379
-
4.Adjust`config/auto-pruned-labels.jsonc`if you want different exact default-delete specs.
382
+
4.Leave`config/github-default-labels.jsonc`alone unless GitHub changes its default labels.
380
383
5. Configure `config/repository-filter.jsonc` for blacklist mode or whitelist mode.
381
384
6. Set the labels on this repository to the label set you want to manage.
382
385
7. Run `Config-Label_Sync` once if you want to populate `config/labels.jsonc` immediately.
@@ -386,5 +389,5 @@ The GitHub App installation must be granted access to this configuration reposit
386
389
387
390
-`labels.jsonc` starts empty until you define or sync labels on this repo
388
391
- all repos in the org are targeted unless excluded by `repository-filter.jsonc`
389
-
- GitHub default labels are auto-pruned by default only when they exactly match the stored name, color, and description and are not managed in `labels.jsonc`
392
+
- GitHub default labels are pruned by default when they exactly match `config/github-default-labels.jsonc`; uncheck `delete_github_default_labels` to keep them
390
393
- deleting unmanaged labels is off by default unless you check `delete_missing` when running `Org-Label-Sync`
assert(Array.isArray(githubDefaultLabels),"config/github-default-labels.jsonc must contain an array.");
202
202
203
203
constseen=newSet();
204
204
205
-
returndeleteLabels.map((entry,index)=>{
206
-
assert(entry&&typeofentry==="object"&&!Array.isArray(entry),`Delete label at index ${index} must be an object.`);
207
-
assert(typeofentry.name==="string"&&entry.name.trim(),`Delete label at index ${index} is missing a valid name.`);
208
-
assert(typeofentry.color==="string"&&/^[0-9a-fA-F]{6}$/.test(normalizeColor(entry.color)),`Delete label "${entry.name}" must have a 6-character hex color.`);
209
-
assert(typeofentry.description==="string",`Delete label "${entry.name}" must include a string description.`);
205
+
returngithubDefaultLabels.map((entry,index)=>{
206
+
assert(entry&&typeofentry==="object"&&!Array.isArray(entry),`GitHub default label at index ${index} must be an object.`);
207
+
assert(typeofentry.name==="string"&&entry.name.trim(),`GitHub default label at index ${index} is missing a valid name.`);
208
+
assert(typeofentry.color==="string"&&/^[0-9a-fA-F]{6}$/.test(normalizeColor(entry.color)),`GitHub default label "${entry.name}" must have a 6-character hex color.`);
209
+
assert(typeofentry.description==="string",`GitHub default label "${entry.name}" must include a string description.`);
`Synced ${managedLabels.length} managed labels from ${repository} into config/labels.jsonc. Source labels take precedence over ${deleteLabels.length} exact auto-pruned label specs.`,
79
+
`Synced ${managedLabels.length} managed labels from ${repository} into config/labels.jsonc. Source labels take precedence over ${githubDefaultLabels.length} exact GitHub default label specs.`,
0 commit comments