fix(renovate): pre-seed PR cache to avoid Codeberg 504 on initial sync

Codeberg's API times out (504) when fetching 100 closed PRs
(GET /pulls?state=all&limit=100), but succeeds with limit=20.
Renovate uses limit=100 on the first run and limit=20 on incremental
syncs. Pre-seeding the repository cache with one dummy entry tricks
Renovate into using the limit=20 incremental path from the start.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Thomas SharedInbox
2026-05-26 18:09:41 +02:00
co-authored by Claude Sonnet 4.6
parent 2f0da5b475
commit 0552b7a48c
+6
View File
@@ -844,6 +844,10 @@ func (m *Ci) PublishAndroid(
// Renovate runs Renovate bot against the repository on Forgejo/Codeberg.
func (m *Ci) Renovate(ctx context.Context, renovateToken *dagger.Secret) (string, error) {
// Codeberg's GET /pulls?state=all&limit=100 times out (504) but limit=20 succeeds.
// Renovate uses limit=100 for the initial cache build and limit=20 for incremental
// syncs. Pre-seeding the cache with one dummy entry forces the limit=20 path.
const prCacheJSON = `{"revision":13,"platform":{"gitea":{"pullRequestsCache":{"items":{"999999":{}},"updated_at":null,"author":"guettlibot"}}}}`
return dag.Container().
From("renovate/renovate:43").
WithSecretVariable("RENOVATE_TOKEN", renovateToken).
@@ -851,6 +855,8 @@ func (m *Ci) Renovate(ctx context.Context, renovateToken *dagger.Secret) (string
WithEnvVariable("RENOVATE_ENDPOINT", "https://codeberg.org").
WithEnvVariable("RENOVATE_REPOSITORIES", "guettli/sharedinbox").
WithEnvVariable("LOG_LEVEL", "info").
WithEnvVariable("RENOVATE_REPOSITORY_CACHE", "enabled").
WithNewFile("/tmp/renovate/cache/renovate/repository/forgejo/guettli/sharedinbox.json", prCacheJSON).
WithExec([]string{"renovate"}).
Stdout(ctx)
}