Skip to content

feat(repos): onboard a repository with one command #6773

Description

@dan-petty

Problem

Owner direction of 2026-11-22: "simplify repo onboarding to a single command and the minimum number of manual steps as required by github permissions model, not 10+ steps that have to be figured out every time I add a repo".

  • On 2026-11-22 the onboarding of dan-petty/infra and dan-petty/devtools took more than 10 steps by hand, found one at a time: the release environment, its branch rule, variable and secret; the Renovate preset; the release-please config and workflow; scope labels that devops pr create needs; the merge settings; the webhook of the Service; service.repos; and the checks of devops roadmap onboard.
  • The settings now differ between repositories (2026-11-22): devops-cli is squash only with the PR title; infra, homelab and vibes also allow merge and rebase; auto-merge is off in danielpetty.com, homelab and vibes; danielpetty.com and homelab have no ruleset.
  • devops roadmap onboard (feat(roadmap): onboard checks a repository for the roadmap jobs #1359) checks 7 prerequisites and creates only missing labels. It prints the other steps.
  • feat(gh): manage GitHub organization and repository settings as code #5311 plans repository settings as code with OpenTofu (integrations/github), and leaves labels, secret values and webhooks out of tofu.

Proposed remedy

One command, for example devops repos onboard <owner>/<name>, that a person runs with their own GitHub login (only a person changes settings and secrets). It does every step that the GitHub API allows, opens one pull request with the files of the templates, and prints only the steps that GitHub allows only a person in the web UI to do. --plan shows the steps and changes nothing. Running it again changes nothing on a repository that is already onboarded.

A design study first answers:

  1. The list of each onboarding step, with its source, and for each one: API with the token of the person, file in the template pull request, or web UI only (with the GitHub document that says so).
  2. How the command and feat(gh): manage GitHub organization and repository settings as code #5311 split the settings, so that one place owns each setting.
  3. The templates of the pull request (Renovate preset, release-please, PR title check, labels, clear-status) and where they live (dan-petty/infra).
  4. How the command reads secret values by reference (keyring or a file) and never prints them.

Acceptance criteria

  • A design names each step and its group, with sources, and the owner decides it.
  • After the build, onboarding a new repository is one command plus at most the steps that GitHub allows only in the web UI, and the command on an onboarded repository reports no change.

Person steps

  • The owner decides the design.

Dependencies

Alternatives check of 2026-11-22: partly.
Tool: integrations/terraform-provider-github (https://github.com/integrations/terraform-provider-github), MIT, last activity 2026-11-19, maintained.
Reason: Searches found no single onboarding tool; the GitHub provider that the issue and ADR 0026 already use applies repository, environment, label and webhook settings declaratively, but it opens no template pull request and prints no web-UI-only steps.

Covers:

  • Declarative merge, ruleset and branch-rule settings
  • Environments, variables, secrets and webhook resources
  • A plan shows drift, so a rerun changes nothing

Lacks:

  • Opens no pull request with the template files
  • Secret values sit in state, not read by reference
  • Prints no list of web-UI-only steps
  • No design study of each step and its group

Activity

  1. added
    type/feature
    source/agent
    status/new
    effort/high
    on Nov 22, 2026
  2. dan-petty commented on Nov 22, 2026

    @dan-petty
    OwnerAuthor
  3. added
    value/high
    scope/repos
    priority/p2-medium
    on Nov 22, 2026
  4. devops-cli-service commented on Nov 22, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (7)

    Tools considered:

    Searches run:

    • GitHub repository onboarding automation single command setup labels webhooks secrets, results: 5
    • tool to manage GitHub repository settings as code labels branch protection secrets, results: 5
    • safe-settings probot repository settings yaml, results: 5
    • peribolos kubernetes test-infra repository configuration yaml, results: 5
    • terraform github provider repository settings resource, results: 5
    • github safe-settings, results: 5
    • github cli extension apply repository settings from config file labels environments webhooks, results: 5

    Sources:

  5. dan-petty commented on Nov 22, 2026

    @dan-petty
    OwnerAuthor

    devops repos onboard: final design for #6773

    Summary

    Build one command: devops repos onboard <owner>/<name> --confirm. The person runs it with their gh login. It applies each repository setting by REST, opens one template pull request and connects the Service.

    Manual steps for a new public repository today: 1, the command run. Web UI steps: 0. After #6769: 1 more web UI step.

    The command

    devops repos onboard <owner>/<name> [--plan | --dry-run | --confirm]
      [--create --visibility public|private] [--scope <label>]...
      [--release-type simple|python|node] [--language <lang>] [--service]
      [--template-ref vX.Y.Z] [--release-key-file <pem>] [--rotate-release-key]
      [--no-deploy] [--only <row>,...]
    devops repos onboard --all --plan
    
    • --plan (default) sends GET requests only. --dry-run sends no request. --confirm writes.
    • --all --plan is the nightly drift check. It exits 1 on a pending change. Apply and drift use one code path.
    • Flags give values only before .copier-answers.yml exists. Then the command refuses a flag that differs from that file.
    • Idempotence: each row reads, compares and writes only differences. On an onboarded repository, --confirm sends 0 writes and exits 0. After a failure, the next run continues.
    • It replaces devops roadmap onboard and reuses its rows (src/devops_cli/roadmap/onboard.py:447, :477) and tests (tests/roadmap/test_roadmap_onboard.py:255, :290).

    What it does

    Step How Owner
    0 Preflight Scopes repo, workflow; ruleset probe (403 = plan limit); fail on a SERVICE_APP_* name none
    1 Create POST /user/repos, only with --create command
    2 Repository PATCH /repos/{o}/{r}: squash only, PR_TITLE/PR_BODY, auto-merge, secret scanning (ADR 0012:153) command, infra baseline
    3 Security Vulnerability alerts, private reporting, immutable releases, CodeQL default setup, workflow permissions read command
    4 Code Quality GET code-quality/setup; on 404 "not available", report it; else PATCH state=configured command
    5 Environment release, branch policy main, variable RELEASE_APP_CLIENT_ID command
    6 Release secret devops gh secret sync --env release route command; value in keyring
    7 App check GET installation; on a miss, PUT /user/installations/{id}/repositories/{rid} App installations
    8 Labels POST missing labels only package, repository
    9 Template PR Copier at the infra tag, devops ai agents, draft PR (AGENTS.md rule 6), wait for checks infra, then repository
    10 Ruleset main POST or PUT on a difference; require only checks that reported command
    11 Ready Mark ready, turn on auto-merge (D3); running checks read "pending" person's login
    12 Hook Until #4417; * counts as all events (#6662) command
    13 Service service.repos, push-secrets --rotate, deploy-stack (D4) person's config
    14 Cluster --service only: homelab services PR homelab
    15 RAG Ingestion pass (onboard.py:400-444) Service

    The baseline keeps the code_quality rule. It does not block merges (ruleset 21466414 has it, and #6766 merged). After a move to a Team organization, row 4 turns the feature on.

    A route-ownership test lists each write route. It fails when a route writes a setting of another owner (tofu, the Service, the template).

    What stays with a person

    1. Each repository: run the command. GitHub rule: only the authenticated user creates a personal repository (https://docs.github.com/en/rest/repos/repos#create-a-repository-for-the-authenticated-user). Rulesets need admin access (https://docs.github.com/en/rest/repos/rules#create-a-repository-ruleset).
    2. Once: store the release key and client ID with devops config set. GitHub rule: GitHub never returns a secret value (https://docs.github.com/en/rest/actions/secrets).
    3. Each repository, after feat(gh): set a release App key of its own in each repository #6769: make an App key in the web UI. GitHub rule: the doc gives only web UI steps, at most 25 keys (https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/managing-private-keys-for-github-apps).
    4. Private repository on Free: D2. GitHub rule: rulesets answer 403, and Free plans get environments only on public repositories (https://docs.github.com/en/actions/how-tos/deploy/configure-and-manage-deployments/manage-environments).
    5. --service only: merge the homelab PR. Project rule: only a person merges (AGENTS.md).
    6. Only if row 7 fails: add the repository in Settings > Applications. Not expected (ADR 0032:53). No doc says that "All repositories" covers later repositories (https://docs.github.com/en/apps/using-github-apps/installing-a-github-app-from-a-third-party). Not verified: the row 7 PUT with a classic token.

    Code Quality needs 0 steps. The API exists (https://docs.github.com/en/rest/code-quality/code-quality). Here, GET answers 404 "not available", because the feature needs a Team or Enterprise license (https://docs.github.com/en/billing/concepts/product-billing/github-code-quality).

    Templates

    Home: dan-petty/infra (ADR 0032:40, :57). copier.yml uses _subdirectory: templates/repository and has no tasks, so no --trust. The Renovate copier manager proposes new tags (https://docs.renovatebot.com/modules/manager/copier/).

    Files: renovate.json, labels.yml (scopes only), CODEOWNERS, callers pr-title.yml and release.yml, release-please files, openspec/config.yaml, .devops/project.toml, .pre-commit-config.yaml.

    infra adds two workflow_call workflows (none today). pr-title reads the caller's labels.yml. The release job sets environment: release (https://docs.github.com/en/actions/how-tos/reuse-automations/reuse-workflows).

    Left out: clear-status.yml (#4660 moves it to the Service), workflow label copies, secrets.

    Secrets

    Relation to #5311, #1359, #6769, #6770

    Build plan

    # Issue Tokens Agent-days
    1 infra: Copier template, github/repository.yaml 0.6M 0.5
    2 infra: reusable pr-title and release workflows 0.4M 0.5
    3 devops-cli: devops gh secret sync --env 0.3M 0.5
    4 devops-cli #6773: command, ownership test, docs 2.4M 2.75
    5 devops-cli: nightly drift Job 0.4M 0.5
    6 devops-cli: ADR that amends 0026 0.2M 0.25
    7 Converge the 7 existing repositories 0.2M 0.25

    Total: about 4.5M tokens, 5.25 agent-days, 2 calendar days. Issues 1-3 come before 4, and #4660 before or with 4. #4417 deletes row 12. After D1, flag (do not drop) #6377, #3775, #3742, #3753, #3770, #4664 and #4913.

    Decisions for the owner

    • D1: The command owns the repository settings (amend ADR 0026). Recommendation: yes. It works now, with no tofu prerequisite.
    • D2: Private repository on Free: public, Pro, or no release flow. Recommendation: no release flow. Never a repository secret: any branch can read it.
    • D3: The command marks the template PR ready and turns on auto-merge after the checks pass. Recommendation: yes. If no, the merge is person step 2.
    • D4: --confirm edits service.repos and deploys. Recommendation: yes, from a clean origin/main only.
  6. dan-petty commented on Nov 22, 2026

    @dan-petty
    OwnerAuthor

    Owner decisions of 2026-11-22 on the design above (given to the agent session, recorded here):

    • D1: the command devops repos onboard owns the repository settings (merge methods, rulesets, environments, variables). A new ADR amends ADR 0026 decisions 1, 4 and 7 (feat(gh): manage GitHub organization and repository settings as code #5311): tofu keeps only the organization checks and the transfer check.
    • D2: a private repository on the Free plan gets no release flow: no release-please workflow, no key, and never a repository-level secret.
    • D3: after the checks of the template pull request pass, the command marks it ready and turns on auto-merge, with the login of the person. It requires only the checks that reported.
    • D4: --confirm adds the repository to service.repos and runs push-secrets and deploy-stack, only from a clean origin/main checkout of devops-cli.

    Build issues follow, and this item is the command itself.

  7. added
    owner/agent
    status/in-progress
    and removed
    status/new
    on Nov 22, 2026
  8. added a commit that references this issue on Nov 22, 2026
  9. added
    status/in-review
    and removed
    status/in-progress
    on Nov 22, 2026
  10. added a commit that references this issue on Nov 22, 2026
  11. added a commit that references this issue on Nov 22, 2026
  12. removed
    status/in-review
    owner/agent
    on Nov 22, 2026
  13. devops-cli-service commented on Nov 22, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-22 23:51 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/highpriority/p2-mediumscope/repossource/agenttype/featurevalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions