-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Auto-format before checks #6275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto-format before checks #6275
Conversation
WalkthroughConsolidates PR auto-formatting into an Changes
Sequence Diagram(s)sequenceDiagram
participant PR as Pull Request
participant Auto as auto_format_pr (ci.yaml)
participant CI as Dependent CI Jobs
PR->>Auto: PR event triggers job
activate Auto
Auto->>Auto: checkout PR branch\ninstall rustfmt\nrun cargo fmt
Note over Auto: Detect formatting diffs
alt Formatting changes detected
Auto->>PR: git commit & push formatted changes
Auto->>PR: post PR comment instructing to pull latest changes
Auto-x Auto: exit (fails to signal author to sync)
else No formatting changes
Auto-->>Auto: complete successfully
end
deactivate Auto
Note right of CI: Jobs now have needs: auto_format_pr\nand condition: !cancelled() && !contains(labels,'skip:ci')
Auto->>CI: unblocks dependent jobs or triggers re-run if branch changed
activate CI
CI->>CI: run tests/lint/etc.
deactivate CI
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.github/workflows/ci.yaml (1)
381-384: Add consistent conditional guards to lint job.The
lintjob hasneeds: auto_format_prbut lacks theif: ${{ !cancelled() && !contains(...) }}conditional that other downstream jobs (rust_tests, exotic_targets, snippets_cpython, miri, wasm, wasm-wasi) include. This inconsistency could cause the lint job to run in scenarios where other jobs are skipped due to label-based filtering.Apply this diff to add the conditional:
lint: name: Check Rust code with clippy + if: ${{ !cancelled() && !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} needs: - auto_format_pr runs-on: ubuntu-latest
📜 Review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/ci.yaml(7 hunks).github/workflows/pr-auto-commit.yaml(0 hunks)
💤 Files with no reviewable changes (1)
- .github/workflows/pr-auto-commit.yaml
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: ShaharNaveh
Repo: RustPython/RustPython PR: 5932
File: .github/workflows/comment-commands.yml:18-24
Timestamp: 2025-07-10T10:08:43.330Z
Learning: In GitHub Actions workflows for the RustPython project, the maintainer ShaharNaveh prefers to keep workflows simple and doesn't mind if steps fail when the desired state is already achieved (e.g., user already assigned to an issue). Avoid suggesting complex error handling for edge cases they don't consider problematic.
📚 Learning: 2025-07-10T10:08:43.330Z
Learnt from: ShaharNaveh
Repo: RustPython/RustPython PR: 5932
File: .github/workflows/comment-commands.yml:18-24
Timestamp: 2025-07-10T10:08:43.330Z
Learning: In GitHub Actions workflows for the RustPython project, the maintainer ShaharNaveh prefers to keep workflows simple and doesn't mind if steps fail when the desired state is already achieved (e.g., user already assigned to an issue). Avoid suggesting complex error handling for edge cases they don't consider problematic.
Applied to files:
.github/workflows/ci.yaml
🪛 actionlint (1.7.8)
.github/workflows/ci.yaml
148-148: property "git_commit" is not defined in object type {git-commit: {conclusion: string; outcome: string; outputs: {string => string}}}
(expression)
167-167: "github.event.pull_request.head.ref" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/reference/security/secure-use#good-practices-for-mitigating-script-injection-attacks for more details
(expression)
174-174: property "git_commit" is not defined in object type {git-commit: {conclusion: string; outcome: string; outputs: {string => string}}}
(expression)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: Run snippets and cpython tests on wasm-wasi
- GitHub Check: Check the WASM package and demo
- GitHub Check: Run snippets and cpython tests (ubuntu-latest)
- GitHub Check: Run tests under miri
- GitHub Check: Run snippets and cpython tests (macos-latest)
- GitHub Check: Run snippets and cpython tests (windows-latest)
- GitHub Check: Check Rust code with clippy
- GitHub Check: Run rust tests (windows-latest)
- GitHub Check: Run rust tests (ubuntu-latest)
- GitHub Check: Run rust tests (macos-latest)
- GitHub Check: Ensure compilation on various targets
- GitHub Check: auto_format
|
@ShaharNaveh could you test this workflow with a mal-formatted commit? |
|
The main issue I encounter ATM is the fact that github actions prevents you from doing recursive calls to the workflow. I can't get the checks to trigger after the auto-format commit |
|
#6295 replaced it. Thank you for the work! |
closes #6272
Summary by CodeRabbit
Chores
Style