Skip to content

Use GitHub app token to access firecracker repo#24

Merged
bchalios merged 3 commits into
mainfrom
feat/github-app-token
Jun 1, 2026
Merged

Use GitHub app token to access firecracker repo#24
bchalios merged 3 commits into
mainfrom
feat/github-app-token

Conversation

@bchalios
Copy link
Copy Markdown
Contributor

Use a token created by a Github App to access (clone) the firecracker repo

bchalios and others added 2 commits May 29, 2026 15:45
The "e2b-dev/firecracker" string was hardcoded as the default for five
separate function parameters. Hoist it into a FIRECRACKER_REPO constant
at module scope so future renames are a single-line change.

Pure refactor — no behaviour change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Babis Chalios <babis.chalios@e2b.dev>
Route the git clone through a short-lived installation token supplied by
the workflow as FIRECRACKER_REPO_TOKEN, using the x-access-token user.
The token works for both public and private repositories, so the wiring
is the same regardless of repo visibility — and gives us a higher
rate limit ceiling than the default GITHUB_TOKEN.

Fail loudly via :? if the env var is missing rather than falling back to
unauthenticated clones, which would silently mask a misconfigured
workflow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Babis Chalios <babis.chalios@e2b.dev>
@cla-bot cla-bot Bot added the cla-signed label May 29, 2026
@cursor
Copy link
Copy Markdown

cursor Bot commented May 29, 2026

PR Summary

Medium Risk
Changes release pipeline credentials and cross-repo access; misconfigured app secrets or permissions would break builds or block validation against firecracker.

Overview
The manual release workflow now mints a GitHub App token for e2b-dev/firecracker in the validate and build jobs (via new FIRECRACKER_APP_ID / FIRECRACKER_APP_PRIVATE_KEY secrets), instead of relying on the default GITHUB_TOKEN for that private fork.

Validation passes FIRECRACKER_GH_TOKEN into scripts/validate.py, which overrides GH_TOKEN for gh api calls so tag/commit resolution and CI checks hit the firecracker repo with the right scope. Build sets FIRECRACKER_REPO_TOKEN for build.sh, which now requires that env var and clones with https://x-access-token:…@github.com/e2b-dev/firecracker.git rather than an unauthenticated public URL.

Reviewed by Cursor Bugbot for commit 2806c6b. Bugbot is set up for automated code reviews on this repo. Configure here.

@bchalios bchalios force-pushed the feat/github-app-token branch from e077682 to 149e05f Compare May 29, 2026 13:56
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 149e05f. Configure here.

Comment thread .github/workflows/release.yml Outdated
Route both the validate job's gh_api calls and the build job's
git clone through a short-lived installation token minted by
actions/create-github-app-token@v2. The default GITHUB_TOKEN can't
read repos outside this one, so it isn't enough on its own.

Partition tokens by purpose rather than swapping GH_TOKEN wholesale:

- GH_TOKEN stays the default GITHUB_TOKEN, used for fc-versions
  operations (gh release view in get_existing_release_assets, etc.).
- FIRECRACKER_GH_TOKEN carries the App token. gh_api() in validate.py
  is the only firecracker-API path, so we override GH_TOKEN in its
  subprocess env to use this token instead.

A simpler-looking design — set GH_TOKEN to the App token for the whole
validate step — happens to work today because fc-versions is public
and GitHub's API accepts any bearer token for public reads. But it
would silently break the moment fc-versions flips private:
get_existing_release_assets would 404, has_new_artifacts would always
be true, and the publish job would do pointless extra work.

The build job mints its own token only when check_release decided we
actually need to build, avoiding a wasted mint on no-op runs, and
passes it to build.sh as FIRECRACKER_REPO_TOKEN.

publish/deploy keep using github.token — they only touch this repo
and GCS, no firecracker access needed.

Today this targets the public e2b-dev/firecracker repo. When the
source flips to a private fork, only three things change: the
FIRECRACKER_REPO constant in validate.py, the host string in
build.sh, and the repositories list here.

Requires two new repo secrets: FIRECRACKER_APP_ID and
FIRECRACKER_APP_PRIVATE_KEY.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bchalios bchalios force-pushed the feat/github-app-token branch from 149e05f to 2806c6b Compare May 29, 2026 14:18
@bchalios bchalios merged commit a5935f4 into main Jun 1, 2026
7 checks passed
@bchalios bchalios deleted the feat/github-app-token branch June 1, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants