Trigger auto-fix auto-matically (#44947)
This updates our CI workflow to try to run the autofix.yml workflow if any of prettier, cargo fmt, or cargo clippy fail. Release Notes: - N/A
This commit is contained in:
@@ -18,6 +18,12 @@ pub fn autofix_pr() -> Workflow {
|
||||
.add_input(pr_number.name, pr_number.input())
|
||||
.add_input(run_clippy.name, run_clippy.input()),
|
||||
))
|
||||
.concurrency(
|
||||
Concurrency::new(Expression::new(format!(
|
||||
"${{{{ github.workflow }}}}-{pr_number}"
|
||||
)))
|
||||
.cancel_in_progress(true),
|
||||
)
|
||||
.add_job(run_autofix.name.clone(), run_autofix.job)
|
||||
.add_job(commit_changes.name, commit_changes.job)
|
||||
}
|
||||
|
||||
@@ -237,10 +237,11 @@ fn check_style() -> NamedJob {
|
||||
.add_step(steps::cache_rust_dependencies_namespace())
|
||||
.add_step(steps::setup_pnpm())
|
||||
.add_step(steps::script("./script/prettier"))
|
||||
.add_step(steps::cargo_fmt())
|
||||
.add_step(steps::trigger_autofix(false))
|
||||
.add_step(steps::script("./script/check-todos"))
|
||||
.add_step(steps::script("./script/check-keymaps"))
|
||||
.add_step(check_for_typos())
|
||||
.add_step(steps::cargo_fmt()),
|
||||
.add_step(check_for_typos()),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -326,7 +327,8 @@ pub(crate) fn run_platform_tests(platform: Platform) -> NamedJob {
|
||||
.add_step(steps::setup_node())
|
||||
.add_step(steps::clippy(platform))
|
||||
.when(platform == Platform::Linux, |job| {
|
||||
job.add_step(steps::cargo_install_nextest())
|
||||
job.add_step(steps::trigger_autofix(true))
|
||||
.add_step(steps::cargo_install_nextest())
|
||||
})
|
||||
.add_step(steps::clear_target_dir_if_large(platform))
|
||||
.add_step(steps::cargo_nextest(platform))
|
||||
|
||||
@@ -344,3 +344,13 @@ pub fn git_checkout(ref_name: &dyn std::fmt::Display) -> Step<Run> {
|
||||
"git fetch origin {ref_name} && git checkout {ref_name}"
|
||||
))
|
||||
}
|
||||
|
||||
pub fn trigger_autofix(run_clippy: bool) -> Step<Run> {
|
||||
named::bash(format!(
|
||||
"gh workflow run autofix_pr.yml -f pr_number=${{{{ github.event.pull_request.number }}}} -f run_clippy={run_clippy}"
|
||||
))
|
||||
.if_condition(Expression::new(
|
||||
"failure() && github.event_name == 'pull_request' && github.actor != 'zed-zippy[bot]'",
|
||||
))
|
||||
.add_env(("GITHUB_TOKEN", vars::GITHUB_TOKEN))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user