.github/smartcloud.yml: one YAML file, on your default branch, that tells smartcloud what to do in the repository. Every feature is off until you give it a section, so the file only ever does what you wrote in it. The rest of these docs also call it the config. Do not confuse it with the settings section inside it, which changes the repository’s own GitHub settings (step 11).
This guide builds a complete file from nothing, one section at a time. After each step you can commit and watch it work, so if something surprises you, you know which step caused it. It assumes you have already added the workflow from Getting started. For ready-made files you can copy whole, see Recommended setups.
How the file is read
Knowing what smartcloud does with the file makes every later step easier to reason about. Each time the workflow runs:- An event starts the run: a pull request opened, a comment posted, a push to
main, the daily schedule. - smartcloud reads
.github/smartcloud.ymlfrom the default branch, never from the pull request. A pull request cannot loosen the rules it is checked against; a change to the file takes effect once it merges. - Presets are merged in. Anything under
extendsis read first and your file is laid on top. You can add to a preset, never change it (Add, never change). - Mistakes are dropped, not fatal. An unknown key or a bad value is left out with a warning in the
smartcloud / configcheck, so a typo never stops the repository working.smartcloud validateis strict and catches them before you commit. - Each feature with a section runs, if the event is one it acts on. Labelling runs on pull requests and issues, stale on the schedule, settings on a push or the schedule. The table at the end lists them all.
- Results are reported: one check run per feature (
smartcloud / labels,smartcloud / conventions, …), one comment on the pull request or issue, and the job summary in the Actions tab.
- Rules are keyed maps, never lists. Each label, labelling rule or convention has a key you choose (
docs:,title:). The key is how presets and your file merge, and how a finding names the rule it is about. - A section being present turns its feature on.
commands: {}is enough to turn commands on with every default. Delete a section to turn the feature off.
Step 1: the skeleton
Create.github/smartcloud.yml on the default branch:
.github/smartcloud.yml
- The first line points editors such as VS Code (with the Red Hat YAML extension) at the JSON Schema, so they complete every key and underline mistakes as you type. It is a comment, so smartcloud ignores it.
version: 2is required. A file without it is read as an old v1 config and converted on the fly; see Migrating from v1.
Step 2: who runs the project (roles and links)
Several features need to know who the maintainers are and which bots to trust, so set this up first.
roles.maintainersare GitHub logins. The review gate counts their approvals, and the commits, disclosure and sync checks go easier on their own pull requests (a warning rather than an error). The ruleset approvals and the review gate only switch on once two or more are listed, so a project with one maintainer is never blocked by its own rules.roles.trustedBotsskip the commits and disclosure checks and the review gate. Quote them:[bot]would otherwise be read as a YAML list.links.policyBaseis where your governance documents live. Findings link to pages under it, such asCONTRIBUTING.md#dco. Leave it out and they link to the Resnovas documents, which is fine while you try things out.
Step 3: the labels (labels)
Labels come early because later sections (labelling, stale, lock) refer to them.
- The key (
docs) is what other sections use;nameis what GitHub shows. - Quoting colours is recommended, not required. YAML reads a colour made only of digits, such as
000000, as a number; smartcloud turns it back into the six digits you wrote, so it works either way. Quotes make it plain to the reader (and to editors that check the file) that it is text. - Add
labelSync: { prune: true }only when you want smartcloud to delete every label the file does not list. Leave it out while you are getting started. - To rename a label without losing it on old issues, give the new
nameand list the old one underaliases.
Step 4: label things automatically (labelling and sizeLabels)
- A labelling rule puts
label(a key from step 3) on the subject while itswhenpasses, and takes it off again when it stops passing. whenis a condition group: a list of yes-or-no questions. Withoutrequires, all of them must pass; withrequires: 1, any one is enough.sizeLabels: {}addsSize: XStoSize: XLto every pull request by how many lines it changes.
documentation if it changes a file under docs/, and one size label. The smartcloud / labels check lists what it added or removed.
Step 5: title rules (conventions)
- A convention rule fails the subject when it does not meet the
preset, itswhen, or both. conventionalCommitsasks for titles likefix(api): reject expired tokens. Addcontexts: [api, web]to allow only those scopes.level: warningmakes a rule advisory: it reports, but does not fail the check.
Update readme fails smartcloud / conventions, and the report comment says why and shows an example. Rename it docs: update readme and the next run passes. See Conventions.
Step 6: one check to require (required)
- The required feature makes the job’s own
smartcloudcheck wait for every other check on the pull request and fail if any of them fails. A ruleset then needs to requiresmartcloudalone, instead of a list that goes stale every time a CI job is renamed. expectlists checks that must appear, as patterns. Name your main CI job here, so the aggregate cannot pass while CI never ran.- It needs
checkRunId: ${{ job.check_run_id }}in the workflow step, which the Getting started workflow already has.
smartcloud job stays running until the other checks finish (up to timeout, 60 minutes by default), then passes or fails with them. See Required.
Step 7: housekeeping (stale and lock)
- stale marks items with no activity, then (with
abandonedAfterDays) marks them abandoned, and (withclose: true) closes them. Any comment or push in between resets the clock. - lock locks the conversation of items that have been closed for
afterDays, so an old thread is not revived by accident. - Both use label names as GitHub shows them, not keys from step 3.
schedule and workflow_dispatch events. Run the workflow by hand (Actions > smartcloud > Run workflow) to see the first sweep now. See Stale and Lock.
Step 8: slash commands (commands)
commands: {} turns on every command, such as /label bug, /assign, /rebase and /stale-snooze, each limited to people with a suitable role. overrides switches single commands off or changes who may use them.
What happens when it runs: on issue_comment events. Comment /help on any issue to see the commands you may use; smartcloud reacts to the comment and replies. See Commands.
Step 9: stricter pull request policy
These sections are for projects that want contributions to meet a bar. Add only the ones you need.
What happens when it runs: each adds its own check (
smartcloud / commits, smartcloud / reviews, …) to every pull request, and its findings to the report comment. Pull requests from trusted bots skip the commits, disclosure and review checks.
Step 10: releases and alerts (backport and notifications)
- backport cherry-picks a merged pull request onto another branch when it carries a label such as
backport release/1.x. It needs its own small workflow; see Backport. - notifications sends failures and stale sweeps to Slack, Discord or Linear. The webhook or key is an Actions secret passed to the step as an environment variable (here
SLACK_WEBHOOK_URL), never written in this file. See Notifications.
Step 11: repository settings (settings)
Step 12: share it (extends and sync)
Once a second repository wants the same rules, stop copying the file. Move the shared parts into a preset and list it under extends, and keep shared files such as LICENSE or dependabot.yml in step with sync:
.github repository. Your organisation’s sync hub walks through setting that up from scratch.
The whole file
Here is everything from steps 1 to 11 in one file, ready to adapt. Each section can be deleted on its own..github/smartcloud.yml
Which section runs when
A pull request from a fork or from Dependabot always runs restricted: it gets a read-only token, so smartcloud skips what it cannot do and says so, rather than failing.
Common problems
I added a section and nothing happened
I added a section and nothing happened
Check three things. The file change must be on the default branch, because smartcloud never reads it from a pull
request. The event must be one the feature acts on (the table above): stale waits for
the schedule, labels sync on a push. And the workflow’s
on: must list that event.The smartcloud / config check warns that a key was ignored
The smartcloud / config check warns that a key was ignored
The key is misspelt, in the wrong place, or its value is the wrong type. The warning names the file and the key. Run
smartcloud validate for the full list, or let your editor underline it using the schema line from step 1.Expected Six hex digits on a colour
Expected Six hex digits on a colour
The colour is not six hexadecimal digits as written, for example a typo, a missing digit, or a value YAML reads as
another kind of number such as
1e3. Fix the digits and, when in doubt, quote it: color: '0E8A16'.cannot change ... it is set by ...
cannot change ... it is set by ...
Your file gives a different value for something a preset in
extends already set. Remove the line, restate it
exactly, or add a new rule under a new key. See Add, never change.Settings or sync were skipped: restricted access
Settings or sync were skipped: restricted access
The run had only the workflow token. Create a GitHub App and pass
its token as
GITHUB_TOKEN.