Skip to content

feat: onResume option on connect/resume #3555

feat: onResume option on connect/resume

feat: onResume option on connect/resume #3555

name: Generated files
on:
pull_request:
permissions:
contents: read
jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
generated: ${{ steps.filter.outputs.generated }}
steps:
- name: Filter changed paths
uses: dorny/paths-filter@0e4a8c6effa4802afeda77dc8d303f8176d7dfad # v3.0.4
id: filter
with:
# `**/!(*.md)` excludes Markdown so docs-only changes don't trigger codegen checks.
filters: |
generated:
- 'spec/**/!(*.md)'
- 'codegen.Dockerfile'
- 'copybara.Dockerfile'
- 'copy.bara.sky'
- 'redocly.yaml'
- 'scripts/fetch-spec.sh'
- 'Makefile'
- 'packages/**/!(*.md)'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- 'package.json'
- '.tool-versions'
- '.github/workflows/generated_files.yml'
check-generated:
name: Generated files
needs: changes
if: ${{ needs.changes.outputs.generated == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Parse .tool-versions
uses: wistia/parse-tool-versions@32f568a4ffd4bfa7720ebf93f171597d1ebc979a # v2.1.1
with:
filename: '.tool-versions'
uppercase: 'true'
prefix: 'tool_version_'
- name: Install pnpm
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0
id: pnpm-install
with:
version: '${{ env.TOOL_VERSION_PNPM }}'
- name: Setup Node
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: '${{ env.TOOL_VERSION_NODEJS }}'
registry-url: 'https://registry.npmjs.org'
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Configure pnpm
run: |
pnpm config set auto-install-peers true
pnpm config set exclude-links-from-lockfile true
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Build codegen image with caching
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: .
file: codegen.Dockerfile
tags: codegen-env:latest
load: true # makes the image available for `docker run`
# Cache is seeded from main by codegen_image_cache.yml. No cache-to
# here: PR-scoped writes are unreadable by other PRs and only fill
# the repo's 10 GB Actions cache, evicting other caches.
cache-from: type=gha
- name: Build copybara image with caching
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: .
file: copybara.Dockerfile
tags: e2b-copybara:latest
load: true # makes the image available for `docker run`
# Cache is seeded from main by codegen_image_cache.yml (see the
# cache-to note above for why there is no cache-to here).
cache-from: type=gha,scope=copybara
# scripts/fetch-spec.sh needs read access to the private e2b-dev/belt
# repo to fetch the volume-content spec. The default `secrets.GITHUB_TOKEN`
# is scoped to this repository only, so mint a short-lived token from
# the Autofixer GitHub App instead, scoped to every repo the fetches
# touch. Fork PRs have no access to the App secret, so they skip the
# mint, run the public infra fetches with the default token, and fall
# back to the tracked volume-content spec (make fetch-specs warns
# instead of failing).
- name: Generate token for spec repos
id: spec-repos-token
if: github.event.pull_request.head.repo.full_name == github.repository
uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2.2.2
with:
app-id: ${{ vars.AUTOFIXER_APP_ID }}
private-key: ${{ secrets.AUTOFIXER_APP_SECRET }}
owner: e2b-dev
repositories: belt,infra
permission-contents: read
- name: Run codegen
env:
GITHUB_TOKEN: ${{ steps.spec-repos-token.outputs.token || github.token }}
run: |
CODEGEN_IMAGE=codegen-env:latest \
COPYBARA_IMAGE=e2b-copybara:latest \
make codegen
- name: Check for uncommitted changes
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "❌ Generated files are not up to date:"
git status --short
git diff
exit 1
else
echo "✅ No changes detected."
fi