|
2 | 2 |
|
3 | 3 | [](https://github.com/github/safe-settings/actions/workflows/create-release.yml)
|
4 | 4 |
|
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. |
6 | 6 |
|
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 |
8 | 8 |
|
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 |
10 | 15 |
|
11 | 16 | 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.
|
12 | 17 |
|
|
32 | 37 | >
|
33 | 38 | > Settings files must have a `.yml` extension only. For now, the `.yaml` extension is ignored.
|
34 | 39 |
|
| 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. |
35 | 47 |
|
36 | 48 | ## How it works
|
37 | 49 |
|
@@ -410,8 +422,17 @@ You can pass environment variables; the easiest way to do it is via a `.env` fil
|
410 | 422 |
|
411 | 423 | 1. Besides the above settings files, the application can be bootstrapped with `runtime` settings.
|
412 | 424 | 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'` |
414 | 425 |
|
| 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. |
415 | 436 |
|
416 | 437 | ### Notes
|
417 | 438 |
|
|
0 commit comments