Feature proposal: Generate safe-settings YAML from existing GitHub configuration (reverse sync)
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- github, javascript
調査の方向性
まず、提案されている generate-settings.js CLI と full-sync.js を比較し、次に lib/settingsGenerator.js の extractor の設計、既存の plugin の find() メソッド、schema/settings.json を確認します。共通部分と上書きの動作を定義し、モックした extractor のテストとラウンドトリップテストを追加して、CLI と repository_dispatch のフローが期待されるファイルまたは PR を生成することを検証します。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- JavaScript
- スター
- 924
- フォーク
- 227
- 平均マージ
- 6時間 8分
- マージ済み PR(30日)
- 15
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
github-community-projects/safe-settings のほかの issue
-
app_installations reports an error on every repo or suborg change when the plugin is not configuredオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
github-community-projects/safe-settings#1111 ·
メンテナーはふだん 1 日以内に返信
-
Repos transferred into the org are not synced (no repository.transferred handler)対応中かも @breymander が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
github-community-projects/safe-settings#1107 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Dry run only inspects the first 30 changed files (pulls.listFiles is not paginated)対応中かも @3rwww1 が 28 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
github-community-projects/safe-settings#1080 ·
メンテナーはふだん 1 日以内に返信
-
PR comment diff table shows an empty vertical scrollbar due to malformed <tr> markup再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
github-community-projects/safe-settings#1077 ·
メンテナーはふだん 1 日以内に返信
-
Bug Report: environment and repo variables API calls don't paginate, failing with more than 10 items対応中かも @cdav が 80 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
github-community-projects/safe-settings#1040 ·
メンテナーはふだん 1 日以内に返信
github-community-projects/safe-settings の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
Unsampled pageload span is profiled when profileLifecycle is 'trace' (browser UI profiling)対応中かも @Jxxunnn が今日担当しました。 オープンBrowser Waiting for: Product Owner
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
getsentry/sentry-javascript#25497 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
resource: destroying a resource calls AbortController.abort() without a reason, creating an AbortError with a stack trace each time対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea: core
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
angular/angular#71422 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug status: needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
facebook/docusaurus#12739 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
factory-active task-identify-harness-labels-done task-identify-issue-type-done
難易度 1/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信