Skip to content

Commit 423a1b7

Browse files
mishushakovclaude
andauthored
ci: seed codegen image cache from main instead of per-PR scopes (#1549)
## Why `generated_files.yml` only runs on `pull_request`, so its `cache-to: type=gha,mode=max` wrote buildkit blobs into per-PR scopes that other PRs cannot read — every new PR cold-built the codegen image (235–365s in 11 of 17 runs over the past week vs ~65s warm), and ~6 GB of duplicate blobs pushed the repo's Actions cache to 9.9 GB of the 10 GB limit, evicting the Playwright and pnpm caches that #1538 relies on. ## What Adds `codegen_image_cache.yml`, which builds the image on pushes to `main` touching its actual inputs (`codegen.Dockerfile`, `packages/connect-python/**`, or the workflow itself) and exports the cache to main's scope, readable by all PRs; it also supports `workflow_dispatch` for manual re-seeding. The PR-side build in `generated_files.yml` keeps `cache-from` but drops `cache-to`. Merging this PR triggers the first seed automatically, since the new workflow file matches its own paths filter. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent dbc6bfa commit 423a1b7

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Codegen image cache
2+
3+
# Seeds the buildkit cache for codegen.Dockerfile from main so pull request
4+
# runs of generated_files.yml warm-start. PR-scoped cache writes are not
5+
# readable by other PRs, so main is the only scope worth writing to.
6+
on:
7+
push:
8+
branches: [main]
9+
paths:
10+
- 'codegen.Dockerfile'
11+
- 'packages/connect-python/**'
12+
- '.github/workflows/codegen_image_cache.yml'
13+
workflow_dispatch:
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
seed:
20+
name: Seed codegen image cache
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Build codegen image and export cache
30+
uses: docker/build-push-action@v6
31+
with:
32+
context: .
33+
file: codegen.Dockerfile
34+
cache-from: type=gha
35+
cache-to: type=gha,mode=max

.github/workflows/generated_files.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ jobs:
8181
file: codegen.Dockerfile
8282
tags: codegen-env:latest
8383
load: true # makes the image available for `docker run`
84+
# Cache is seeded from main by codegen_image_cache.yml. No cache-to
85+
# here: PR-scoped writes are unreadable by other PRs and only fill
86+
# the repo's 10 GB Actions cache, evicting other caches.
8487
cache-from: type=gha
85-
cache-to: type=gha,mode=max
8688

8789
- name: Run codegen
8890
run: CODEGEN_IMAGE=codegen-env:latest make codegen

0 commit comments

Comments
 (0)