diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 306e28b602d5..342fdcc743f0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,6 +36,13 @@ jobs: # TODO: check every members - run: cargo clippy -p cargo --lib --no-deps -- -D warnings + stale-label: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: rustup update stable && rustup default stable + - run: cargo stale-label + # Ensure Cargo.lock is up-to-date lockfile: runs-on: ubuntu-latest diff --git a/crates/xtask-stale-label/src/main.rs b/crates/xtask-stale-label/src/main.rs index beda85721fb9..33f22c35c29e 100644 --- a/crates/xtask-stale-label/src/main.rs +++ b/crates/xtask-stale-label/src/main.rs @@ -3,7 +3,7 @@ //! stale-label //! //! SYNOPSIS -//! stale-label [] +//! stale-label //! //! DESCRIPTION //! Detect stale paths in autolabel definitions in triagebot.toml. @@ -11,7 +11,6 @@ //! ``` use std::fmt::Write as _; -use std::path::Path; use std::path::PathBuf; use std::process; use toml_edit::Document; @@ -19,9 +18,10 @@ use toml_edit::Document; fn main() { let pkg_root = std::env!("CARGO_MANIFEST_DIR"); let ws_root = PathBuf::from(format!("{pkg_root}/../..")); - let triagebot_toml = format!("{pkg_root}/../../triagebot.toml"); - let path = std::env::args_os().nth(1).unwrap_or(triagebot_toml.into()); - let path = Path::new(&path).canonicalize().unwrap_or(path.into()); + let path = { + let path = ws_root.join("triagebot.toml"); + path.canonicalize().unwrap_or(path) + }; eprintln!("Checking file {path:?}\n"); @@ -77,5 +77,7 @@ fn main() { let result = if failed == 0 { "ok" } else { "FAILED" }; eprintln!("test result: {result}. {passed} passed; {failed} failed;"); - process::exit(failed as i32); + if failed > 0 { + process::exit(1); + } }