Skip to content

Commit 5690233

Browse files
docs: update README for unsafeFields
1 parent 4f2ae47 commit 5690233

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

README.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22

33
[![Create a release](https://github.com/github/safe-settings/actions/workflows/create-release.yml/badge.svg)](https://github.com/github/safe-settings/actions/workflows/create-release.yml)
44

5-
`Safe-settings` an app to manage policy-as-code and apply repository settings across an organization.
5+
`Safe-settings` - an app to manage policy-as-code and apply repository settings across an organization.
66

7-
1. In `safe-settings`, all the settings are stored centrally in an `admin` repo within the organization. Unlike the [GitHub Repository Settings App](https://github.com/repository-settings/app), the settings files cannot be in individual repositories.
7+
## Settings Locations
88

9-
> It is possible specify a custom repo instead of the `admin` repo with `ADMIN_REPO`. See [Environment variables](#environment-variables) for more details.
9+
Settings can be stored in:
10+
- An `admin` repository within the organization.
11+
> It is possible to specify a custom repo instead of the `admin` repo with `ADMIN_REPO`. See [Environment variables](#environment-variables) for more details.
12+
- A `.github/settings.yml` file in each repository (like the [GitHub Repository Settings App](https://github.com/repository-settings/app)). See [Unsafe Settings](#unsafe-settings) for more details.
13+
14+
### `admin` Repository
1015

1116
1. The **settings** in the **default** branch are applied. If the settings are changed on a non-default branch and a PR is created to merge the changes, the app runs in a `dry-run` mode to evaluate and validate the changes. Checks pass or fail based on the `dry-run` results.
1217

@@ -32,6 +37,13 @@
3237
>
3338
> Settings files must have a `.yml` extension only. For now, the `.yaml` extension is ignored.
3439
40+
### Unsafe Settings
41+
42+
In the [runtime settings](#runtime-settings) file, it is possible to specify a list of `unsafeFields` that are allowed to be configured by repositories in the organization. Each `unsafeField` is expressed as a [JSON Pointer](https://datatracker.ietf.org/doc/html/rfc6901). All values under an `unsafeField` are also 'unsafe', so it is advised to provide the unsafeFields as precisely as possible.
43+
44+
See the [sample deployment settings](./docs/sample-settings/sample-deployment-settings.yml) for an example of configuring `unsafeFields`.
45+
46+
With this set, repositories can create `.github/settings.yml` files (not currently configurable) that will be merged with values in the `admin` repository when safe-settings is run. Entries in this file that do not match `unsafeFields` in the runtime settings will be ignored.
3547

3648
## How it works
3749

@@ -410,8 +422,17 @@ You can pass environment variables; the easiest way to do it is via a `.env` fil
410422
411423
1. Besides the above settings files, the application can be bootstrapped with `runtime` settings.
412424
2. The `runtime` settings are configured in `deployment-settings.yml` that is in the directory from where the GitHub app is running.
413-
3. Currently the only setting that is possible are `restrictedRepos: [... ]` which allows you to configure a list of repos within your `org` that are excluded from the settings. If the `deployment-settings.yml` is not present, the following repos are added by default to the `restricted`repos list: `'admin', '.github', 'safe-settings'`
414425
426+
#### Restricted Repos
427+
428+
Use `restrictedRepos: [...]` to configure a list of repos within your `org` that are excluded from the settings. If the `deployment-settings.yml` is not present, the following repos are added by default to the `restricted`repos list:
429+
- `admin`
430+
- `.github`
431+
- `safe-settings`
432+
433+
#### Unsafe Fields
434+
435+
Use `unsafeFields: [...]` to mark fields as configurable from individual repos. See [Unsafe Settings](#unsafe-settings) for more details.
415436
416437
### Notes
417438

0 commit comments

Comments
 (0)