Skip to content

fix: preserve cached indexing results #137

fix: preserve cached indexing results

fix: preserve cached indexing results #137

Workflow file for this run

name: Auto-fix
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: write
pull-requests: write
concurrency:
group: autofix-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
autofix:
name: Auto-fix formatting and lints
runs-on: ubuntu-latest
# Only run on same-repo PRs (no forks)
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
steps:
- name: Checkout PR branch
uses: actions/checkout@v6
with:
# Checkout the PR head so we can push back to it
ref: ${{ github.head_ref }}
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt,clippy
- name: Cache cargo artifacts
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Configure git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Run auto-fixes
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
run: |
set -e
cargo fmt --all
# Clippy fix may not fix everything; don't fail if it can't
cargo clippy --all-targets --all-features --fix --allow-dirty --allow-staged || true
# cargo fix for Rust warnings; do not fail if none applicable
cargo fix --all-targets --all-features --allow-dirty --allow-staged || true
- name: Commit and push changes
run: |
git add -A
if ! git diff --staged --quiet; then
git commit -m "fix: auto-apply rustfmt, clippy, and cargo fix"
git push
fi