Skip to content

feat(github): write a Renovate App installation token to a file #4897

Description

@dan-petty

Problem or Motivation

Self-hosted Renovate (#4893) runs as its own GitHub App. Renovate accepts only a GitHub App installation token, which expires after 1 hour. It has no App ID or private-key option. The three tools that the Renovate docs name fail the project rules:

  • actions/create-github-app-token runs only in GitHub Actions.
  • The npm package github-app-installation-token had its last release in January 2022.
  • The image mshekow/github-app-installation-token has no license.

No devops command writes an installation token to a file today. The existing minting code in src/devops_cli/github/app_installation.py (gidgethub) serves the Service App only.

Proposed Solution & Architectural Design

  • Add the settings renovate.github_app_id, renovate.github_app_installation_id and renovate.github_app_private_key (keyring row renovate_github_app_private_key), in the form of the argocd.github_app_* settings.
  • Add one devops command. The proposal names it, for example devops github app-token --app renovate --write <path>.
  • The command reuses src/devops_cli/github/app_installation.py. It asks for the Renovate permission set: administration read, checks write, statuses write, contents write, vulnerability_alerts read, issues write, metadata read, pull_requests write, workflows write.
  • It writes the token to a file with mode 0600. It never prints the token, and no log line holds it.
  • --dry-run makes no request. It shows the request that a run makes, with the token as a placeholder.
  • A missing setting gives an error that names the setting.
  • An init container of the Renovate CronJob (feat(deps): track regular version updates with Renovate #4893 child 4) runs the command. Only this container mounts Secret devops/renovate. The Renovate container reads the token file through config.js and never sees the App key or Secret devops/devops-cli.

Git identity: Renovate finds <slug>[bot] and <app-id>+<slug>[bot]@users.noreply.github.com from the App token. So no config and no request holds an email address.

Target Subsystem

SDLC, Git & PR Governance (GitHub App auth).

Existing Tool Considered

Rejected: the three tools above; Link-/gh-token (MIT and maintained, but it has no image, so a pod downloads a binary at run time); the External Secrets Operator GithubAccessToken generator (it adds an operator to the cluster); a hand-written JWT in the Renovate pod (home-grown crypto).

Build cost (AGENTS.md rule 3): about 100 lines of code and 150 lines of tests over the existing minting code; about 150k tokens to build; little upkeep; about 1.5 hours of agent time.

Acceptance Criteria

  • Tests that fail on the base and pass on the branch:
    • The token request body holds exactly the permission set above.
    • The token file has mode 0600.
    • The token is in no stdout, stderr or log line.
    • --dry-run sends 0 requests.
    • A missing setting gives an error that names the setting.
  • docs/CONFIGURATION.md and docs/ENV_VARS.md list the 3 settings.

Dependencies

None. Child 2 of #4893. The owner creates the App and stores the 3 settings after this merges (#4893 owner steps 1 to 3).

Source: #4893

Alternatives check of 2026-11-14: in-use.
The repository already uses this tool.
Tool: gidgethub/gidgethub (https://github.com/gidgethub/gidgethub), Apache-2.0, last activity 2026-09-25, maintained.

Proposed design

Problem statement

Self-hosted Renovate needs a GitHub App installation token written to a file. No devops command does this today. The existing minting code in src/devops_cli/github/app_installation.py serves only the Service App. This issue adds the renovate settings, one command that mints the token and writes it to a file with mode 0600, and the tests and docs.

Acceptance criteria

Requirement: renovate-permission-set

The token request body SHALL hold exactly the Renovate permission set: administration:read, checks:write, statuses:write, contents:write, vulnerability_alerts:read, issues:write, metadata:read, pull_requests:write, workflows:write.

Scenario: request body holds the 9 permissions

  • WHEN the command mints a token for the renovate app
  • THEN the POST body permissions dict holds exactly the 9 named permissions and no others

Requirement: token-file-mode

The token file SHALL have mode 0600.

Scenario: file mode is 0600

  • WHEN the command writes the token to a file
  • THEN the file mode is 0600

Requirement: token-secrecy

The token SHALL NOT appear in stdout, stderr, or any log line.

Scenario: token absent from all output

  • WHEN the command completes a successful token write
  • THEN the token string is absent from stdout, stderr, and all log records

Requirement: dry-run-no-request

The --dry-run flag SHALL send 0 HTTP requests and show the request with the token as a placeholder.

Scenario: dry run sends nothing

  • WHEN the command runs with --dry-run
  • THEN 0 HTTP requests are sent and the output shows the request body with a placeholder for the token

Requirement: missing-setting-error

A missing setting SHALL produce an error that names the setting.

Scenario: missing app id names the key

  • WHEN renovate.github_app_id is not set and the command runs
  • THEN the error message names renovate.github_app_id

Requirement: docs-list-settings

docs/CONFIGURATION.md and docs/ENV_VARS.md SHALL list the 3 new settings.

Scenario: docs contain the 3 settings

  • WHEN the settings are added to the code
  • THEN docs/CONFIGURATION.md and docs/ENV_VARS.md each list renovate.github_app_id, renovate.github_app_installation_id, and renovate.github_app_private_key

Existing Tool Considered

gidgethub (https://github.com/gidgethub/gidgethub) is in-use: it covers the JWT signing and installation-token exchange in src/devops_cli/github/app_installation.py. It lacks the CLI command, --write with mode 0600, --dry-run, and the renovate settings. Build cost (AGENTS.md rule 3): about 100 lines of code and 150 lines of tests over the existing minting code; about 150k tokens to build; little upkeep; about 1.5 hours of agent time.

Key questions

  • Which open, maintained tool or library covers the need?: gidgethub is in-use. It covers the JWT signing and installation-token exchange. It lacks the CLI command, file writing with mode 0600, dry-run, and the renovate settings. Build cost: about 100 lines of code, 150 lines of tests, about 150k tokens, about 1.5 hours of agent time. [sources: src/devops_cli/github/app_installation.py]
  • What is the command name and interface?: devops github app-token --app renovate --write <path>. The --app flag selects the app whose settings to read. The --write flag names the output file. --dry-run is a global flag. (best practice) [sources: src/devops_cli/github/app_installation.py]
    • Chosen: devops github app-token --app renovate --write <path>. The body names this form. It follows the existing devops github command group and the --app pattern used by other commands.
    • Rejected: devops renovate token --write <path>. A separate command group for renovate. Rejected: the body names the github group, and the command is generic enough to serve other apps later.
  • What are the setting names and where do they resolve?: renovate.github_app_id, renovate.github_app_installation_id, and renovate.github_app_private_key. The first two resolve as normal settings. The private key resolves as a keyring row renovate_github_app_private_key. The form follows the argocd.github_app_* settings. (best practice) [sources: docs/CONFIGURATION.md, src/devops_cli/config/settings.py]
    • Chosen: renovate.github_app_* mirroring argocd.github_app_*. The body names this form. The argocd section in docs/CONFIGURATION.md shows the pattern: github_app_id and github_app_installation_id as settings, the private key as a keyring row.
    • Rejected: A single renovate.github_app object with nested fields. A nested object. Rejected: the body names flat keys in the form of the argocd settings, and the existing code reads flat keys.
  • What permission set does the token request?: administration:read, checks:write, statuses:write, contents:write, vulnerability_alerts:read, issues:write, metadata:read, pull_requests:write, workflows:write. The body lists these 9 permissions. (best practice) [sources: src/devops_cli/github/app_installation.py]
    • Chosen: The 9 permissions named in the body. The body lists them. They match the Renovate docs' required permission set.
    • Rejected: Reuse CONST_GITHUB_APP_TOKEN_PERMISSIONS. The existing constant. Rejected: it holds the Service App's permission set, not Renovate's. The body names a different set.
  • What file mode does the token file get, and how is the token kept out of output?: Mode 0600. The command never prints the token. No log line holds it. The existing code already keeps the token out of log lines: the logger.info in mint_installation_token names the permissions, not the token. (best practice) [sources: src/devops_cli/github/app_installation.py]
    • Chosen: Mode 0600, token never printed. The body names 0600 and the secrecy rule. The existing code already avoids logging the token.
    • Rejected: Mode 0644. World-readable. Rejected: the token is a credential. 0600 is the minimum safe mode.
  • What does --dry-run do?: It sends 0 HTTP requests. It shows the request that a run would make, with the token as a placeholder. The body names this behavior. (best practice) [sources: src/devops_cli/github/app_installation.py]
    • Chosen: 0 requests, show request with placeholder token. The body names this. It follows the project's dry-run convention: no request, show what would happen.
    • Rejected: Send the request but do not write the file. A partial dry-run. Rejected: the body says 0 requests, and the project convention is that dry-run makes no request.
  • What error does a missing setting produce?: An error that names the missing setting. The existing configured_app() in src/devops_cli/github/app_installation.py raises ConfigurationError naming each missing setting. The new command follows this pattern. (best practice) [sources: src/devops_cli/github/app_installation.py]
    • Chosen: Error names the missing setting key. The body names this. The existing configured_app() already does this for the Service App settings.
    • Rejected: Generic error with no key name. A generic message. Rejected: the body requires the error to name the setting, and the existing code already names keys.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/feature
    scope/github
    status/new
    value/medium
    on Nov 12, 2026
  3. added
    value/medium
    and removed
    value/medium
    on Nov 12, 2026
  4. added
    effort/low
    and removed
    value/medium
    on Nov 12, 2026
  5. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/github. The (github) scope of the title gives the scope.
    • Priority: P2-Medium. The command is a child of #4893 and it blocks the self-hosted Renovate setup, but it does not block other work.
    • Value: Medium. The command gives the Renovate CronJob a safe App token and it removes the need for an unmaintained third-party tool.
    • Effort: Low. The change reuses the existing minting code in app_installation.py and needs about 100 lines of code and 150 lines of tests.
    • Related: feat(security): the App's installation tokens carry only the permissions the roadmap jobs use #2473, which asks for a different change. Both items work on GitHub App installation token minting, but item 2473 limits the permissions of the Service tokens and the candidate adds a Renovate token-to-file command with its own permission set.
  6. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/github. The (github) scope of the title gives the scope.
    • Priority: P2-Medium. It is a prerequisite for the self-hosted Renovate CronJob but does not block the core project.
    • Value: Medium. It enables one specific self-hosted Renovate deployment path for a subset of users.
    • Effort: Low. The body estimates about 100 lines of code and 150 lines of tests over existing minting code.
    • Related: feat(k8s): auto-mint and synchronize argocd.token and grafana.token in deploy-stack #764, which asks for a different change. Both mint tokens for external tools, but #764 covers ArgoCD and Grafana in deploy-stack while the candidate adds a new Renovate-specific command with its own settings.
  7. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The searches returned no usable results, so I read the facts of the named libraries directly: gidgethub (Apache-2.0/MIT, maintained, v6.0.0) is already the project's GitHub transport per ADR 0006 and already holds the installation-token minting code in src/devops_cli/github/app_installation.py, so it covers the token-minting half of the need. It gives no CLI command, no --write <path> with mode 0600, no --dry-run and no Renovate settings, so the command, the file handling and the tests in the issue still have to be written; the alternative CLI gh-token was already ruled out in the body.

    The repository already uses this tool.

    Tool: gidgethub/gidgethub (https://github.com/gidgethub/gidgethub)

    • License: Apache-2.0
    • Last activity: 2026-09-25
    • Maintained: yes

    Covers:

    • Mints a GitHub App JWT and exchanges it for an installation access token
    • Sends the permissions in the installation-token request body, so the Renovate permission set can be passed as given
    • Is already the project's GitHub client and is already used by src/devops_cli/github/app_installation.py, so the minting half needs no new dependency

    Lacks:

    • No CLI command and no --write <path> option, so nothing writes the token to a file with mode 0600
    • No --dry-run that shows the token request with the token as a placeholder and sends 0 requests
    • No Renovate settings (renovate.github_app_id, renovate.github_app_installation_id, renovate.github_app_private_key in keyring) and no error that names a missing setting
    • No guarantee that the token stays out of stdout, stderr and log lines

    Tools considered:

    Searches run:

    • gh-token github app installation token generator maintained MIT, results: 5
    • CLI tool mint GitHub App installation token and write to file, results: 5
    • "github-app-token" Link-/gh-token repository, results: 5
    • octokit auth-app create installation access token node library, results: 5
    • renovate self-hosted github app installation token file, results: 5
    • github app installation token python gidgethub, results: 5
    • gidgethub apps get installation access token permissions, results: 5

    Sources:

    Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.

  8. added
    status/ready
    and removed
    status/new
    on Nov 16, 2026
  9. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 7ba78c5 (see proposed design in issue body).

  10. added
    owner/agent
    status/in-progress
    and removed
    status/ready
    on Nov 16, 2026
  11. added
    status/in-review
    and removed
    status/in-progress
    on Nov 16, 2026
  12. removed
    status/in-review
    owner/agent
    on Nov 16, 2026
  13. added a commit that references this issue on Nov 16, 2026
  14. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor
  15. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-16 18:14 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/lowpriority/p2-mediumscope/githubsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions