extends gets them. Change the preset and every repository follows on its next run.
Why use one:
- One source of truth. Labels, title rules, review rules and repository settings stay the same everywhere.
- Rules that stick. A repository can add to a preset but cannot weaken it. A contributor cannot quietly turn off the DCO check in one repository.
- Short configs. A repository’s own file holds only what makes it different.
Use a preset
1
Name it under extends
Add an
extends list to .github/smartcloud.yml. Each entry is owner/repo/path@ref:.github/smartcloud.yml
2
Make sure the token can read it
smartcloud reads presets through the GitHub API with the token it acts with. A preset in a public repository, or in the same repository, always works. A preset in another private repository needs a token that can read it, such as a GitHub App installed on both repositories. With only the workflow token, the preset is skipped with a warning; see Reading presets.
3
Check it
GITHUB_TOKEN or the GitHub CLI’s login.@v1.2.0) means the preset only changes when you move the ref. Tracking a branch (@main) means every repository picks up a change on its next run.
Write a preset
A preset is an ordinary config file withversion: 2. Put it in any repository, commonly the organisation’s .github repository. It may extend presets of its own, up to five levels deep.
my-org/.github/smartcloud/typescript.yml
.github repository, from creating it to rolling a change out to every repository.
How files are merged
Presets are merged first, in the order listed. Each preset’s own presets come before it. The repository’s config comes last.version, extends and $schema describe a file rather than rules, so they are never merged.
Add, never change
Everything a preset sets is locked. A repository may add to what it inherits, but never change or remove it:- Adding is allowed. A new label, a new rule, or a new field on an inherited rule that the preset left unset.
- Identical restatements are allowed. Repeating an inherited value exactly as it already is changes nothing, so a repository can keep a full copy of a rule without error.
- Changing is an error. Any other value for something already set, whether a scalar, a list or a different shape, fails the whole run.
roles.maintainers, a repository cannot add a name to it.
Given a preset like this one (an example, not the Resnovas house preset):
your-org/.github/smartcloud/base.yml
bug identically, adds a description the preset left unset, and adds a new label.
.github/smartcloud.yml
”I need something different from the preset”
Because locked values cannot change, you have three honest options:- Add a new rule next to it. For example, a second convention rule with its own key, or an extra label. This is what the error message suggests.
- Fill in what the preset left open. Presets often leave fields unset on purpose, such as
sync.excludeorsettings.environments, so each repository adds its own. - Change the preset, or stop extending it and copy what you need. If a rule is wrong for one repository, it is usually wrong in the preset.
Reading presets
The action reads presets through the GitHub API with its own token, so a preset in a private repository needs a token that can read that repository. A restricted run, such as a pull request from a fork or a run with only the workflow token, leaves out a preset from another repository that its token cannot read. It warns that the preset’s rules were not checked (access.config-skipped) rather than failing, and each feature’s check that would pass concludes as neutral with “config left out” in its title. A missing preset in the repository itself still fails the run. See Restricted runs.
These problems fail the run, because the config as a whole cannot be trusted:
The Resnovas house preset
Every Resnovas repository extendsResnovas/.github/smartcloud/house.yml@main, the house preset. It lives in the public Resnovas/.github repository, so any token can read it, including the read-only token of a pull request from a fork. The settings and sync sections it sets still need the Resnovas Bot app token, which the house workflow mints; forks and Dependabot run without it, restricted.
What it turns on:
Left unset on purpose, so each repository adds its own:
settings.environments(aprojectTypesuch aslibrary, or named environments);settings.rulesetfieldsrequiredDeployments,statusChecks.checks(the repository’s CI job),codeScanning.ESLintandcodeCoverage.enabled;sync.exclude, for template files the repository keeps its own copy of;required.expect, the check names the aggregate must wait for;- any other labels, labelling rules, stale, lock, backport, freeze, notifications or commands sections.
house:managed and house:local
In a Resnovas repository you do not write theextends line yourself. The sync feature keeps .github/smartcloud.yml in line with a template, using a managed block:
.github/smartcloud.yml
- Between
house:managed:beginandhouse:managed:endis the house’s part. Sync rewrites it, and a pull request that edits it fails the sync edit check (ruleSYNC). - Below
house:localis the repository’s part. Sync never touches it. Put your additions here.
house:local, within the add-never-change rule: new labels and rules, and the keys the house preset leaves unset. A value the house preset already sets cannot be changed there; restating it exactly is allowed, but any other value fails the run. To change a house value, change house.yml in Resnovas/.github.
Troubleshooting
"cannot change ... it is set by ..."
"cannot change ... it is set by ..."
Your file gives a different value for something a preset already set. Remove the line, or restate it exactly as the
preset has it, or add a new rule with a new key. See Add, never change.
A warning says a preset's rules were not checked
A warning says a preset's rules were not checked
The run was restricted and could not read a preset in another private repository. This
is expected on pull requests from forks and from Dependabot. On your own pull requests, pass a token that can read
the preset, such as a GitHub App installed on both repositories.
"could not be read"
"could not be read"
The path, repository or ref is wrong, or the token cannot see the repository. Check the entry by opening
https://github.com/owner/repo/blob/ref/path. Run smartcloud doctor to test the token.A preset key is ignored with a warning
A preset key is ignored with a warning
The preset uses a key this version of smartcloud does not know, usually because the preset was written for a newer
release. The run carries on without it. Update the action (
resnovas/smartcloud@v2 moves with every v2 release) to
pick it up."presets extend each other in a loop" or "nested more than 5 deep"
"presets extend each other in a loop" or "nested more than 5 deep"
Follow the chain in the message and remove one
extends entry so the chain ends.