Skip to content

fix(renovate): Shard org run to avoid 1h app token expiry#533

Closed
mnorbury wants to merge 1 commit into
mainfrom
salvador-v2
Closed

fix(renovate): Shard org run to avoid 1h app token expiry#533
mnorbury wants to merge 1 commit into
mainfrom
salvador-v2

Conversation

@mnorbury
Copy link
Copy Markdown
Contributor

@mnorbury mnorbury commented Jun 2, 2026

Problem

The Renovate workflow runs autodiscover across the whole org under a single GitHub App installation token, which GitHub hard-caps at 1 hour. Long runs outlived the token and started returning 401 Bad credentials mid-run (Renovate's CLI does not refresh the token). The following shows how most runs finish at ~1hour after a burst of 401s when the token runs out.

image

Fix

Split the run into a discover job that lists the installation's repos (excluding archived) and chunks them into small shards, then a parallel renovate matrix job where each shard mints its own fresh token and processes only its few repos (default 4) via RENOVATE_REPOSITORIES — so every Renovate process finishes well within the 1-hour token window. Shard size is configurable via a new repos_per_shard input, the matrix job timeout drops to 55m, and the cache key is now per-shard.

The org-wide autodiscover run could exceed the 1-hour lifetime of the
GitHub App installation token, causing 401s mid-run. Split the run into a
discover job that chunks repos into small shards, then a parallel matrix
job where each shard mints its own fresh token and processes a few repos
via RENOVATE_REPOSITORIES, finishing well within the token window.
@mnorbury mnorbury requested a review from Copilot June 2, 2026 08:37
@mnorbury mnorbury marked this pull request as ready for review June 2, 2026 08:37
@mnorbury mnorbury requested a review from a team as a code owner June 2, 2026 08:37
@mnorbury mnorbury requested review from thepicachu and removed request for a team June 2, 2026 08:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Renovate GitHub Actions workflow to avoid GitHub App installation token expiry during long org-wide autodiscover runs by splitting work into multiple parallel shards, each with its own freshly minted token.

Changes:

  • Add a discover job that lists accessible (non-archived) repos and builds a shard matrix (configurable via repos_per_shard).
  • Convert renovate into a matrix job that runs Renovate per shard using RENOVATE_REPOSITORIES and a per-shard cache key.
  • Reduce the per-job timeout to 55 minutes to better align with the 1-hour App token lifetime.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +71 to +73
matrix="$(printf '%s\n' "${repos}" | jq -R . | jq -s \
--argjson size "${REPOS_PER_SHARD}" \
'[ _nwise($size) | join(",") ] | to_entries | map({ id: .key, repos: .value })')"
Comment on lines +52 to +53
set -euo pipefail

@mnorbury
Copy link
Copy Markdown
Contributor Author

mnorbury commented Jun 2, 2026

Closed in favour of #534

@mnorbury mnorbury closed this Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants