From ff71f4d46d282aaf656ddc7d38324affabe88a89 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Fri, 19 Dec 2025 14:27:44 -0700 Subject: [PATCH] Run cargo fix as well as cargo clippy --fix (#45394) Release Notes: - N/A --- .github/workflows/autofix_pr.yml | 4 ++++ tooling/xtask/src/tasks/workflows/autofix_pr.rs | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/.github/workflows/autofix_pr.yml b/.github/workflows/autofix_pr.yml index d3688a722a..33da35cb2a 100644 --- a/.github/workflows/autofix_pr.yml +++ b/.github/workflows/autofix_pr.yml @@ -54,6 +54,10 @@ jobs: - name: autofix_pr::run_autofix::run_cargo_fmt run: cargo fmt --all shell: bash -euxo pipefail {0} + - name: autofix_pr::run_autofix::run_cargo_fix + if: ${{ inputs.run_clippy }} + run: cargo fix --workspace --release --all-targets --all-features --allow-dirty --allow-staged + shell: bash -euxo pipefail {0} - name: autofix_pr::run_autofix::run_clippy_fix if: ${{ inputs.run_clippy }} run: cargo clippy --workspace --release --all-targets --all-features --fix --allow-dirty --allow-staged diff --git a/tooling/xtask/src/tasks/workflows/autofix_pr.rs b/tooling/xtask/src/tasks/workflows/autofix_pr.rs index ab59e73522..231cbb6850 100644 --- a/tooling/xtask/src/tasks/workflows/autofix_pr.rs +++ b/tooling/xtask/src/tasks/workflows/autofix_pr.rs @@ -63,6 +63,12 @@ fn run_autofix(pr_number: &WorkflowInput, run_clippy: &WorkflowInput) -> NamedJo named::bash("cargo fmt --all") } + fn run_cargo_fix() -> Step { + named::bash( + "cargo fix --workspace --release --all-targets --all-features --allow-dirty --allow-staged", + ) + } + fn run_clippy_fix() -> Step { named::bash( "cargo clippy --workspace --release --all-targets --all-features --fix --allow-dirty --allow-staged", @@ -101,6 +107,7 @@ fn run_autofix(pr_number: &WorkflowInput, run_clippy: &WorkflowInput) -> NamedJo .add_step(steps::setup_pnpm()) .add_step(run_prettier_fix()) .add_step(run_cargo_fmt()) + .add_step(run_cargo_fix().if_condition(Expression::new(run_clippy.to_string()))) .add_step(run_clippy_fix().if_condition(Expression::new(run_clippy.to_string()))) .add_step(create_patch()) .add_step(upload_patch_artifact())