ci: format and auto-commit diffs instead of just checking#320
Conversation
Co-Authored-By: ben@e2b.dev <ben@e2b.dev>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.
Once credits are available, reopen this pull request to trigger a review.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| run: bun run format | ||
|
|
||
| - name: Commit formatting changes | ||
| uses: stefanzweifel/git-auto-commit-action@v5 |
There was a problem hiding this comment.
🔒 Agentic Security Review
Severity: MEDIUM
Using stefanzweifel/git-auto-commit-action@v5 (mutable tag) in a job with contents: write introduces a supply-chain trust risk: if that tag is retargeted or compromised upstream, this workflow can run attacker-controlled code with repository write permissions.
Impact: Unauthorized commits could be pushed to PR branches from CI.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 12056c91d9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| format: | ||
| name: Format | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository |
There was a problem hiding this comment.
Retain formatting check for forked pull requests
The new job-level condition restricts format to same-repo PRs only, so fork PRs now skip formatting entirely. In GitHub Actions, a skipped job is treated as successful for required checks, which means external contributions can merge without any formatter validation. If auto-commit is only intended for same-repo branches, keep the formatter step running for all PRs and gate only the commit step behind the same-repo condition.
Useful? React with 👍 / 👎.
Summary
Refactors the
Formatjob in.github/workflows/code-quality.ymlso it actually runs the formatter and pushes any resulting diff back to the PR branch, instead of failing CI when the working tree isn't already formatted.Changes:
bunx biome ci --formatter-enabled=true ...withbun run format(which runsbiome check --write --linter-enabled=false --assist-enabled=true).stefanzweifel/git-auto-commit-action@v5that commits any formatting diffs asgithub-actions[bot]with the messagestyle: apply biome formatting.pull_requestevents from same-repo branches and grantscontents: write(least-privilege override of the workflow's top-levelcontents: read). Skipped onpushtomain(no pushing to main from CI) and on fork PRs (defaultGITHUB_TOKENcan't push to forks).ref: ${{ github.head_ref }}so the actual PR branch (not the merge commit) is checked out for committing back.The
LintandKnipjobs are untouched.Note: the auto-pushed commit will not retrigger CI on the PR (GitHub safety behavior with default
GITHUB_TOKEN); reviewers may need to push an empty commit or re-run workflows if they want CI to run on the auto-formatted state.Review & Testing Checklist for Human
.tsfile) and confirm theFormatjob runsbun run formatand pushes astyle: apply biome formattingcommit back to the branch.Formatcleanly with no extra commit.LintandKnipstill run and behave the same on PRs.mainstill works as expected (this PR doesn't touch it, but the workflow's permissions changed).Notes
GITHUB_TOKENcannot push to forks. If you want fork PRs handled too, that requires either a dedicated bot PAT or moving topull_request_target(which has security implications).push: [main]trigger — pushing automated commits back tomainwould conflict with branch protection and is risky. Format issues on main should be caught by the PR-side job before merge.Link to Devin session: https://app.devin.ai/sessions/d2582a2e217f4687aa7f9ffd3c457026