- a workflow that runs smartcloud when pull requests, issues and comments change, and once a day on a schedule;
- a config file,
.github/smartcloud.yml, that turns on a few features; - a first run you can read, on a pull request and in the Actions tab.
1. Decide which token smartcloud acts with
smartcloud does its work (adding labels, posting comments, creating checks) through the GitHub API, so it needs a token. There are two choices.
Start with the workflow token. You can add an app later without changing your config: only the workflow changes. With an app, smartcloud still does everything in the repository with the workflow token and keeps the app’s token for settings, sync, CODEOWNERS proposals and presets, as Tokens and access explains.
Optional: create a GitHub App
Only do this if you want the settings or sync features, or your config extends a preset in another private repository.1
Create the app
In your organisation (or your account), go to Settings > Developer settings > GitHub Apps > New GitHub App. Give it a name, set any homepage URL, and untick Webhook > Active: smartcloud runs in Actions and needs no webhook.
2
Give it repository permissions
Grant these repository permissions, and leave everything else at No access:
The settings feature can manage more than this (secrets, variables, environments, Pages, webhooks, collaborators and teams). Each part needs the matching permission; the settings page lists them. A step the token cannot do is reported as a finding, not a crash.
3
Install it and store its credentials
Create the app, then Install App on the repositories that should use it, and on the repository that holds any private preset you extend. Generate a private key. In the repository (or organisation) settings, add:
- a variable
SMARTCLOUD_APP_IDholding the app’s ID, and - a secret
SMARTCLOUD_APP_PRIVATE_KEYholding the whole.pemfile.
2. Add the workflow
Create.github/workflows/smartcloud.yml. Pick the version for the token you chose.
- Workflow token
- GitHub App token
.github/workflows/smartcloud.yml
onlists the events that start a run. Each feature acts only on some of them: stale and lock needschedule, commands needissue_comment, and backports needclosed. The introduction has the full table. Leaving an event out simply means the features that need it never run.permissionsgives the job’s workflow token the access smartcloud uses. The introduction explains each one.timeout-minutes: 75stops a stuck run. It is longer than the 60 minutes the required feature may wait for other checks.checkRunIdlets the required feature find the job’s own check. Without it that feature is skipped.name: smartcloudnames the job, and so the check GitHub creates for it. A ruleset can then require thesmartcloudcheck alone.
actions/checkout step: smartcloud reads the config through the GitHub API, from the default branch, so a pull request cannot loosen the rules it is checked against.
3. Write a first config
Create.github/smartcloud.yml on the default branch. This one is small on purpose: it keeps two labels, labels documentation changes, asks for Conventional Commits pull request titles, and marks quiet issues stale.
.github/smartcloud.yml
version: 2is required. Without it the file is read as a v1 config.- The first line lets editors such as VS Code (with the YAML extension) complete and check every key as you type.
- A feature runs only when its section is present. There is no
commitssection here, so commit checks are off.
Check the config before you push
If you have Node 24 or later, you can check the file locally with the CLI:4. The first run
Commit both files to the default branch. The push starts the first run.1
Watch it in the Actions tab
Open Actions > smartcloud. The run takes a few seconds. On a push, smartcloud syncs the labels, so
documentation and stale now exist under Issues > Labels.2
Try it on a pull request
Open a pull request that changes a file under
docs/, with the title Update the readme. Within a minute:- the pull request gets the
documentationlabel; - the Checks tab shows
smartcloud / labels(passed) andsmartcloud / conventions(failed, because the title is not conventional); - smartcloud posts one comment listing the problem and a link to fix it.
3
Fix it and watch it update
Rename the pull request to
docs: update the readme. The edited event starts a new run. The conventions check passes and the comment changes to “All smartcloud checks pass.”4
Run the daily jobs now
Stale, lock and the settings and sync features run on the daily
schedule. To run them without waiting, open Actions > smartcloud > Run workflow.5. Read the report
smartcloud reports in four places. The reporting page has the detail.
A finding has a level:
- error: something to fix. The feature’s check fails, and so does the run.
- warning: worth a look. The check is neutral, which does not block a required check.
- notice: information only, such as “this run was restricted”. Left out of the comment.
6. Make it enforce
Checks only block merging when a ruleset or branch protection requires them. Two ways:- Require the one job check. With
checkRunIdin the workflow and arequired: {}section in the config, the job’ssmartcloudcheck waits for every other check on the pull request and fails if any fails. Requiresmartcloudalone. See required. - Require single features. Require
smartcloud / conventions,smartcloud / commitsand so on, one by one.
Next steps
Build your settings file
Every section, in the order to add it, and what each does when it runs.
Recommended setups
Complete files for a small repository, a monorepo, an open-source project and an organisation.
Your organisation's sync hub
Share presets and files across every repository from your own .github repository.
Presets and extends
Share one config across many repositories.
Conditions
The rule language used by labelling, conventions, reviews and more.
Troubleshooting
What to do when a run does not do what you expect.
CLI
Validate, dry-run and diagnose from your machine.