Feature proposal: Generate safe-settings YAML from existing GitHub configuration (reverse sync)
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- github, javascript
Direzione di ricerca
Inizia confrontando la CLI generate-settings.js proposta con full-sync.js, quindi esamina il design dell’estrattore per lib/settingsGenerator.js, i metodi find() dei plugin esistenti e schema/settings.json. Definisci il comportamento dell’intersezione e della sovrascrittura, aggiungi test con un estrattore mockato e test round-trip, quindi verifica che i flussi CLI e repository_dispatch generino i file o la PR previsti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Today safe-settings applies declarative YAML config to GitHub. This proposal adds the reverse: generate repos/<name>.yml, suborgs/<name>.yml, and settings.yml from the current state of an org/repo. This helps teams onboard onto safe-settings without hand-authoring config for existing repositories.
Motivation
- Onboarding existing orgs/repos requires manually transcribing current settings into YAML.
- A generator bootstraps an accurate baseline config, which can then be refined and committed.
- The generated files can be validated by feeding them back through safe-settings in nop (dry-run) mode — expecting zero diffs.
Proposed delivery
Two entry points sharing one extraction core:
- Standalone CLI (
generate-settings.js, mirroringfull-sync.js) — writes generated files to the local filesystem. - App trigger via a
repository_dispatchevent (event_type: safe-settings-generate) — opens a PR against the admin repo with the generated file(s).
Client payload:
{
"event_type": "safe-settings-generate",
"client_payload": {
"source_type": "repo | custom-property | org",
"source_value": "<repo-name> | <custom-property-value> | <org>",
"overwrite": false
}
}
When overwrite: false (default) and the target file already exists, the generator writes <name>.sample.yml instead of replacing it.
Design
A new lib/settingsGenerator.js defines an extractor registry: section → "read current state".
- Diffable plugins (labels, collaborators, teams, milestones, autolinks, environments, custom_properties, variables, rulesets) reuse each plugin's existing
find()method, then sanitize API-only fields (id,node_id,url, timestamps, read-only props). - Non-diffable sections need custom reads:
repository(repos.get) andbranches(list protected branches +getBranchProtection). - Output serialized with
js-yaml, optionally validated againstschema/settings.json.
Scope behavior:
source_type |
What we can extract | Output file |
|---|---|---|
repo |
All repo-level plugins | repos/<repo>.yml |
org |
Org rulesets + custom repository roles only | settings.yml |
custom-property (suborg) |
Repo-level settings common to all matching repos | suborgs/<value>.yml |
Open question: how to derive sub-org settings
Sub-orgs represent settings common to a collection of repos. The proposed approach: discover all repos matching the custom property value, extract each repo's config, then reduce by intersection — keep only settings identical across all matching repos (arrays matched by MergeDeep.NAME_FIELDS). A suborgproperties selector is prepended. Alternatives considered: union (risks conflicts) or a single representative repo. Feedback welcome on the intersection strategy and whether to also report per-repo differences.
Scope boundaries
- Secrets are never read (no secrets plugin exists); only API-readable values are emitted, with names/placeholders where values are unreadable.
validatoris excluded (meta plugin).- Round-trip fidelity for
branches/rulesetsis the riskiest area; generated output will be gated by a nop round-trip test.
Verification plan
- Unit tests per extractor + intersection + overwrite/
.samplelogic (mocked octokit). - Round-trip: feed generated
repos/<name>.ymlthrough safe-settings nop mode → expect zero diffs. - Manual dispatch produces a PR (or
.samplefile whenoverwrite: false).
Looking for community feedback before/while implementing, particularly on the sub-org intersection approach and the repository_dispatch payload shape.
- Lingua principale
- JavaScript
- Stelle
- 924
- Fork
- 227
- Merge medio
- 6h 8m
- PR unite (30g)
- 15
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di github-community-projects/safe-settings
-
app_installations reports an error on every repo or suborg change when the plugin is not configuredAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
github-community-projects/safe-settings#1111 ·
I maintainer di solito rispondono entro 1 giorno
-
Repos transferred into the org are not synced (no repository.transferred handler)Forse già presa @breymander l’ha presa 4 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
github-community-projects/safe-settings#1107 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Dry run only inspects the first 30 changed files (pulls.listFiles is not paginated)Forse già presa @3rwww1 l’ha presa 27 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
github-community-projects/safe-settings#1080 ·
I maintainer di solito rispondono entro 1 giorno
-
PR comment diff table shows an empty vertical scrollbar due to malformed <tr> markupForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
github-community-projects/safe-settings#1077 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug Report: environment and repo variables API calls don't paginate, failing with more than 10 itemsForse già presa @cdav l’ha presa 80 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
github-community-projects/safe-settings#1040 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di github-community-projects/safe-settings
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
521xueweihan/HelloGitHub#4025 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
yetone/magpie#2844 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
c1overzz/dsh-bili-scroll#22 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
maproulette/maproulette-frontend#2944 ·
I maintainer di solito rispondono entro 1 giorno