Guide¶
How to start a repository, the kinds of projects, what every repository gets, and what a person sets up once.
Start a repository¶
Git with signing, Python 3.12 or later, uv and GitHub CLI 2.48 or later, signed in as an administrator of the account or organization that will own the repository (gh auth login):
uvx --from copier==9.19.1 copier copy gh:Dennis-Otto/repo-blueprint my-project
cd my-project
python3 .github/blueprint.py create
With pipx in place of uv, the first line is pipx run --spec copier==9.19.1 copier copy gh:Dennis-Otto/repo-blueprint my-project, and a Copier of your own, Copier 9.8 or later, runs copier copy gh:Dennis-Otto/repo-blueprint my-project; on Windows, py -3 runs Python in place of python3. Copying runs no code of the blueprint: the template has no tasks, migrations or Jinja extensions, so Copier needs no --trust.
Copier asks for the name, a one-sentence description, the kind of project, the GitHub account or organization that owns it, the license (MIT, MIT-0, BSD-3-Clause, Apache-2.0, GPL-3.0-or-later or AGPL-3.0-or-later), a few details of the kind and the release app of the owner, which may stay empty until app register registers it. The homepage is the website that the Docs workflow publishes on GitHub Pages, unless you name another or none, and the README, the About box, the issue forms and the manifests link it; each kind starts with topics of its own, such as home-assistant, hacs, which HACS needs. Copier refuses an answer that would break a file, such as a name with """ or a backslash, or that GitHub or the App Store wouldn't take.
create makes the repository of the copy, with no checkout of the blueprint: every copy brings blueprint.py in .github/. It takes the owner and the name from the answers of Copier, and its preflight first checks Python, Git and its signing, GitHub CLI and its sign-in, owner and name; a finding marked with ✘ stops it before anything is made, with the command that fixes it. Then create runs git init --initial-branch=main, commits the files with a sign-off, the scripts and the hook as executable on Windows too, creates the repository with gh repo create and pushes to it, public unless you add --private (green on GitHub Free too), has GitHub register every workflow (why), then applies the settings as code and prints the checklist: what is left for a person, such as the release app and the secrets, and which steps are done.
What create checks first¶
create checks first what its steps need, in its preflight, which only asks: Python 3.12 or later, Git and the name and email address of the first commit, GitHub CLI 2.48 or later, signed in with the scopes repo and workflow, and read:org for an organization, an owner where that account may create the repository, a name that GitHub doesn't have yet, and whether Git signs every commit, which main asks for after the first. A finding marked with ✘ stops it before anything is made and names the command that fixes it, such as gh auth refresh --hostname github.com --scopes workflow, and one marked with · only warns, such as a Git that signs no commit, with how to set up a key; python3 .github/blueprint.py doctor runs the preflight alone, and create --dry-run prints the preflight and the commands and runs none. The troubleshooting explains each finding. When a run stops midway, at the push or at the settings, run create again: in a folder whose origin pushes to the repository on GitHub, it goes on from the first step that is left, the push when GitHub has no branch main yet, then the settings and the checklist. create refuses a folder that pushes to another repository. Every workflow runs on main, so settings check names a repository whose default branch has another name.
What create checks after its push¶
GitHub starts a workflow only once it has registered it, and the first push of a new repository may register none (#652). A run registers its workflow, so every workflow that a push or a pull request starts comes to be known by its first run, but one that only a schedule, a release or a person starts stays unknown, such as the blueprint bot: gh workflow run answers 404 for it, not even its schedule starts it, and the Rollout can't bring it a release. So after its push, create asks GitHub for up to a minute whether it knows every workflow of .github/workflows/, and for those that it doesn't, it runs python3 .github/blueprint.py workflows register. That opens a pull request from the branch bot/register-workflows with one commit that GitHub signs, which adds a comment of three lines to the end of each such workflow. Its merge is a push that changes them, which registers them. Run the command again after the merge, and it opens the pull request that takes the comments out, so that the files are the blueprint's again; while one of the two is open, it names that one. The branch is one of a bot, so the ownership check gives neither a notice. The checklist names each workflow that GitHub doesn't know and each comment that is left, and the command repairs an older repository the same way.
Kinds of projects¶
| Kind | Stack | Checks | Delivery |
|---|---|---|---|
| Home Assistant integration | Python 3.14, pytest-homeassistant | Ruff, mypy, tests, HACS, hassfest | a zip asset for HACS, verified as HACS installs it |
| Nextcloud app | PHP 8.2 and newer, the tools on PHP 8.3, Composer | php-cs-fixer, Psalm with its taint analysis, PHP 8.2 for the code and its packages, PHPUnit in random order with full coverage | signed package to the App Store |
| GitHub Action | Python 3.12 of the runner, composite action | Ruff, mypy, tests, a run of the action | release tags and a moving major tag |
| Python package | Python 3.12, Hatchling | Ruff, mypy, tests, build | PyPI, trusted publishing |
| Node package | Node 24, TypeScript | Biome, tsc, node:test with full coverage, pack; npm without install scripts | npm with provenance |
| Chrome extension | Manifest V3, TypeScript | Node's, the manifest, Chrome for Testing | Chrome Web Store, without a stored secret |
| Electron app | Electron, TypeScript | Node's, the app in Electron, installers on each system | attested, self-updating installers |
| Cloudflare Worker | TypeScript, Wrangler | Biome, tsc, Vitest in workerd | Cloudflare, without a key in GitHub |
| Container image | Alpine by digest | Hadolint, build, self-test | GHCR, multi-arch, with SBOM and provenance |
| Repository without a build | text files, shell scripts | releases only |
Every kind starts with a working example and its tests, and has a page of its own on the website: what it gets, its checks, its delivery and the one line that copies it.
What a new repository gets¶
Each of these pages describes a group of what every repository gets: what runs, the files that run it and the details.
- Checks and the PR coach: What runs in every pull request and on
main, how long it takes, and how a check that fails explains itself. - Fix bot and self-healing: What a repository fixes by itself: the findings that a command can fix, tests that fail once, checks that stop, releases and bots that fail.
- Mutation tests, fuzzing and property tests: The tests beyond the checks of a pull request: whether the tests notice a change of the code, and inputs that nobody wrote down.
- Releases and security: How a change becomes a signed release, and the security checks of every repository.
- Dependencies and updates: How the dependencies and the files of the blueprint stay current, and which files belong to the project.
- Bots, their cost and the dashboard: The bots of issues and pull requests, what starts them and what they cost, and the dashboard of every repository.
- Website, diagrams and screenshots: The website of the documentation, and the diagrams and screenshots that keep themselves current.
- Settings as code: The settings of a repository as a file that a pull request changes.
- Community and development: The files of the community, the dev container and the rules for coding agents.
Set up a repository¶
What a person does once: the release app of the account and its defaults, the secrets and the delivery of each repository, and the way an existing repository takes the blueprint.
Your own account¶
The blueprint works for every account and organization on GitHub, and a repository made from it names nothing of the blueprint's owner but the links to the blueprint. Each owner brings two things of their own:
- A release app, once for all of their repositories. The bots act as a GitHub App of the owner: its token starts the checks of the release and update pull requests, may change workflows and creates the release tags, which the token of a job can't. Only the owner of an app has its private key, so the blueprint can't lend its own. Copy the blueprint with the question of the release app left empty, and after
createone command registers it on your account or organization, with its name and permissions filled in and without a webhook:
python3 .github/blueprint.py app register
You confirm one page on GitHub. The command sets the private key, which no file holds, and opens the pull request that names the app in .github/repository.toml, where only it may create release tags; you install the app and merge the pull request, as the walkthrough shows. app connect --key-file FILE does the same for an app that exists, such as for a further repository. Until then every bot that acts as the app checks for it first and says in its summary what is missing, the variable or the private key, rather than fail at a token: a bot whose work is what the app does, such as the blueprint bot, the settings bot or Renovate, fails, and one that only helps a pull request along, such as the fix bot or the branch bot, warns and goes on without it.
- Your defaults, so that every new repository asks only what is new. Copier's settings file takes the answers that stay the same, on Windows in %LOCALAPPDATA%\copier\settings.yml and on macOS in ~/Library/Application Support/copier/settings.yml:
# ~/.config/copier/settings.yml, or the file that COPIER_SETTINGS_PATH names
defaults:
owner: octo-org
author: Octo Org
release_app: octo-org-release-automation
release_app_client_id: Iv23liExample
release_app_id: "123456"
Two more answers decide what runs for you, and the page Your own account walks through every step:
- Renovate, by the answer
renovate_runner. The blueprint's owner keepshub, the Renovate workflow of the blueprint, which runs it for each of the owner's repositories. Every other owner getsself:.github/workflows/renovate.yml, the same workflow with the same Renovate, pinned by its digest, which runs it every two hours as the release app, with a token for that repository alone, and names the bot user of the app as the author of its commits. In a pull request that changes the rules or a lock file, its check renovate rules shows whether Renovate accepts the rules and reads every file, and explains a failure through the PR coach, as every other check does. Withmend, the owner installs the Mend Renovate app instead, which comes at every push and needs no workflow. Every way reads the same rules, andchecklistticks Renovate off once it has opened a pull request. - The AI of the issue assistant, by the answer
issue_assistant_ai: without it, the variableISSUE_ASSISTANT_AIisoff, the environmentissue-assistantasks for no secret,SUPPORT.mdsays that no AI reads the issues, and the README of a new repository shows no badge of the issue assistant; labels, reminders, closing and the commands of the maintainer go on, and the checklist passes without a token of Claude.
Once per repository¶
- The release app of the owner opens the release and update pull requests, so that their checks run. Register it once for the account, as your own account shows, install it on the repository, and set its private key as the secret
RELEASE_AUTOMATION_PRIVATE_KEYof the environmentrelease. - Its permissions: The app needs the permissions Actions, Administration, Checks, Commit statuses, Contents, Dependabot alerts, Issues, Pages, Pull requests, Variables and Workflows (read and write), and Environments and Secrets (read): with them the settings bot applies the settings as code, Renovate updates the dependencies, the Release workflow closes the Dependabot alerts of the advisories that an
osv-scanner.tomlaccepts, and the rollout of the blueprint starts the blueprint bot of every repository after a release. - Narrower tokens: Renovate gets a token without Administration, and the settings bot one with only Administration, Issues, Pages and Variables (read and write) and Actions, Contents and Environments (read), which can neither push a commit nor change a workflow; GitHub refuses that token to an app that lacks one of them, and the summary of the run says which permissions to grant (decision 0075 of the decisions).
- The settings app: An optional second app, the settings app, takes the administration over: with its Client ID in the variable
SETTINGS_APP_CLIENT_IDand its private key in the secretSETTINGS_APP_PRIVATE_KEYof the environmentrelease, the settings bot asks it for that token instead, the blueprint bot lets the actions of a new release start before it pushes the update, and the release app needs no Administration, Pages, Variables, Environments and Secrets, as your own account shows. - Release tags: The release workflow creates every release tag with the app, and the ruleset Release tag creation lets nobody else create one; the variables
RELEASE_APP,RELEASE_AUTOMATION_CLIENT_IDandRELEASE_AUTOMATION_APP_IDin.github/repository.tomlname the app, from the answersrelease_app,release_app_client_idandrelease_app_id, and a project with another app than its answers name sets them in.github/repository.project.toml. - The issue assistant needs
CLAUDE_CODE_OAUTH_TOKENin the environmentissue-assistant, unless the answerissue_assistant_aiswitched its AI off. - Delivery: what the kind of project needs once, as the checklist says: trusted publishing on PyPI for a Python package or on npm for a Node package, the app certificate and the registration in the App Store of a Nextcloud app, the HACS submission of a Home Assistant integration, the public package of the image of a container after its first release, the Worker of a Cloudflare Worker created with a first deploy and its repository connected with Workers Builds, or for a Chrome extension the first version uploaded by hand in the Developer Dashboard of the Chrome Web Store, with the variables
CWS_EXTENSION_IDandCWS_PUBLISHER_ID, and the sign-in without a stored secret, with the variablesCWS_WORKLOAD_IDENTITY_PROVIDERandCWS_SERVICE_ACCOUNT. - The social preview: a new repository starts with a drawing of its kind of project in
.github/social-preview.html, made from its answers, where the blueprint knows no more of it: the stepuses:of an action in a workflow, thepip installornpm installof a package, thedocker runof an image, a request to a Worker and its answer, the popup of an extension in the toolbar, the app in the navigation of Nextcloud, the entities of an integration, or the start of the README. Replace that panel, whichdata-default-panelmarks, with the project itself: a screenshot of what it shows, or a faithful drawing of what it produces. Then render the picture withbash scripts/social-preview.shand upload.github/social-preview.pngunder Settings → General → Social preview; the checklist names both steps until they are done (decision 0127). GitHub takes the picture only from that upload, so a picture that changes later needs another one: the checklist's step Social preview uploaded and current compares the upload with the committed picture, byte for byte, and the nightly look of the bot-health bot keeps the issue Upload the new social preview open, with the picture and the link, until GitHub shows it. A private repository waits with both until it is public, since GitHub shows the social preview only for a public one (decision 0132). - OpenSSF Best Practices: add the project on bestpractices.dev with the URL of the repository. It proposes the answers of
.bestpractices.json, about 100 of the badge and of the OSPS Baseline that the blueprint guarantees for the kind of project, each with the file that shows it; Save (and continue) 🤖 takes them in on each level, but only for the questions that are still open: it never replaces an answer that the entry gives. So an answer that an update of the file changes, such as the link to a workflow that moved, reaches the entry only through the issue The answers on bestpractices.dev differ from .bestpractices.json, which the weekly run of Links keeps open while the public entry differs from the file: it gives for each level a link of its edit page that proposes the answers of the file and forces exactly those that differ. Open each link while signed in, check the highlighted fields and save; the bot reads the entry only, and closes the issue once it matches (decision 1046). Answer the rest, what only your software and your people can say, in.github/bestpractices.project.toml, a file of your project that no update touches: a table for each criterion, with only the justification of one that.bestpractices.jsonanswers and with the status and the justification of any other. Save doesn't read that file, so its answers reach the entry through the links of the same issue, which force them back over an edit on the site: change an answer in the file, not on bestpractices.dev, andblueprint.py best-practices --verify, a step ofscripts/check.sh, checks it (decision 1088). Then add both badges to the README, as the checklist shows. The blueprint leaves these to you, as decision 0129 explains. Your people: two-factor authentication of everybody with access (OSPS-AC-01.01, secure_2FA), a second person who approves each change ofmain(OSPS-QA-07.01, two_person_review), contributors of different organizations (contributors_unassociated) and a security review (security_review). Never claim a second reviewer for a project of one maintainer; a team requires it withrequired_approvalsof[branch], as the settings show. Your other repositories: N/A for OSPS-QA-04.01 and OSPS-QA-04.02 when every release builds from this repository alone; otherwise list the repositories whose code goes into a release, for example in the README, each with checks as strict as these. Your files: a copyright and a license statement in each source file (copyright_per_file, license_per_file), whichREUSE.tomlgives for every file at once instead; the coverage of the tests (test_statement_coverage80, test_statement_coverage90, test_branch_coverage80), which your project sets for the code that it measures; and a reproducible build (build_reproducible), N/A when nothing is built.
checklist prints the gh secret set commands; the value is typed into the prompt of the GitHub CLI and never appears anywhere else.
An existing repository¶
An existing repository takes the blueprint on a branch, in one pull request:
uvx --from copier==9.19.1 copier copy --overwrite --vcs-ref vX.Y.Z --data sample_code=false gh:Dennis-Otto/repo-blueprint .with the answers that fit the repository, without the sample code and tests of a new one, such as its description, topics and homepage as they are on GitHub, so thatsettings applychanges nothing there. The files of the project (README, changelog, code, tests, manifests, labels, issue forms, icons) stay as they are.- Look at the diff of every file of the blueprint and put back what belongs to the project only: sections of SECURITY.md or CONTRIBUTING.md, rules of Renovate (in
.github/renovate.json5), the hosts and files of the issue assistant (into.github/issue-assistant/config.project.toml), ignore rules.copier updatekeeps these changes from then on. python3 .github/blueprint.py adoptwrites what the files of the project still lack for the bots, and only that: the version of the latest release on GitHub, from its tag, into.release-please-manifest.json, and intoversion.txtwhere the kind of project keeps its version there (--version X.Y.Znames it for a repository whose releases GitHub doesn't have: one without a latest release but with the tag of a version, of a draft, a pre-release or a tag alone, stops until it does, and a tag other thanv1.2.3, as release-please writes it, gets a warning); the heading## Unreleasedabove the first release ofCHANGELOG.md; and the labels of the bots that.github/labels.tomllacks, those of the groupreleasein thelabels.tomlof the template, withmaintenance, which the title check sets as well, andno-bot-fixes, which keeps the fix bot away from a pull request. Before it writes, it checks that origin pushes to the repository of the answers and that GitHub has it, as the preflight ofcreatedoes;--dry-runshows what it would write, and a second run finds nothing more. It then lists the workflows of.github/workflows/that the blueprint doesn't bring.- Put the checks of the project alone, such as its end-to-end tests, into
.github/repository.project.tomlandscripts/check-project.sh, with the patterns of the actions that its own workflows run, whichblueprint.py settings checknames; keep or remove each workflow thatadoptlisted, remove the scripts and tests that the blueprint replaces, and delete files of the template that the project doesn't need, such as a sample test. A repository withoutdocs/has no website until it writesdocs/index.md;mkdocs.ymlshows how German pages join it. - Open the pull request. Once its new checks pass,
blueprint.py settings applyswitches the required checks, the variables and the labels, and the pull request can merge. A classic branch protection ofmainfrom before, whichsettings applynames with what it requires, keeps waiting for the old checks or an approval: remove it, as the line names, since the rulesets protectmainnow.
The configuration of the checks belongs to the blueprint and looks for the code where a new project of the same kind has it. Every file it names comes with the blueprint, also without the sample code:
| Kind | Code | Tests | From the blueprint |
|---|---|---|---|
| Nextcloud app | lib/ |
PHPUnit tests in tests/Unit/ |
psalm.xml and phpunit.xml, with the tests/bootstrap.php and tests/stubs/ that they load |
| Node package | src/, built into dist/ |
test/, typechecked by tsconfig.json; the npm test of a new project runs test/**/*.test.ts |
tsconfig.json and tsconfig.build.json, which need typescript and @types/node in the package.json of the project, and biome.jsonc, whose step Lint and format runs once @biomejs/biome is there too |
| Chrome extension | src/, built into extension/lib/; extension/ with manifest.json and _locales/ |
test/, as for a Node package |
the files of a Node package, with tsconfig.json knowing the DOM and @types/chrome, and tsconfig.build.json writing into extension/lib/; the step Extension needs extension/manifest.json, store/permissions.json and a store/listing.<language>.md for each language |
| Electron app | src/, built into dist/: the main process in src/main/, the preload script in src/preload/, the page in src/renderer/ |
test/, as for a Node package, without the entries src/**/index.ts and src/**/*.cts, which the step App starts |
the files of a Node package, with tsconfig.json knowing the DOM; the step App and the check installers need electron, electron-builder and playwright-core in package.json, an electron-builder.yml and the main of package.json |
| Cloudflare Worker | src/, with the main module that wrangler.jsonc (or wrangler.json, wrangler.toml) names |
test/**/*.test.ts, run in workerd |
vitest.config.ts and tsconfig.json, which need wrangler, vitest, @vitest/coverage-istanbul and @cloudflare/vitest-plugin in package.json and the script typecheck as wrangler types && tsc; scripts/deploy-worker.sh, the deploy command of Workers Builds |
The other kinds set these places in files of their own, such as pyproject.toml. What lies in tests/ belongs to the project: the copy and every update add only the files that are missing there, so an app with its own bootstrap keeps it.