Skip to content

Commit 36653ab

Browse files
committed
ci: add job stale-label
1 parent 9812828 commit 36653ab

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

.github/workflows/main.yml

+7
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ jobs:
3636
# TODO: check every members
3737
- run: cargo clippy -p cargo --lib --no-deps -- -D warnings
3838

39+
stale-label:
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v3
43+
- run: rustup update stable && rustup default stable
44+
- run: cargo stale-label
45+
3946
# Ensure Cargo.lock is up-to-date
4047
lockfile:
4148
runs-on: ubuntu-latest

crates/xtask-stale-label/src/main.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33
//! stale-label
44
//!
55
//! SYNOPSIS
6-
//! stale-label [<FILE>]
6+
//! stale-label
77
//!
88
//! DESCRIPTION
99
//! Detect stale paths in autolabel definitions in triagebot.toml.
1010
//! Probably autofix them in the future.
1111
//! ```
1212
1313
use std::fmt::Write as _;
14-
use std::path::Path;
1514
use std::path::PathBuf;
1615
use std::process;
1716
use toml_edit::Document;
1817

1918
fn main() {
2019
let pkg_root = std::env!("CARGO_MANIFEST_DIR");
2120
let ws_root = PathBuf::from(format!("{pkg_root}/../.."));
22-
let triagebot_toml = format!("{pkg_root}/../../triagebot.toml");
23-
let path = std::env::args_os().nth(1).unwrap_or(triagebot_toml.into());
24-
let path = Path::new(&path).canonicalize().unwrap_or(path.into());
21+
let path = {
22+
let path = ws_root.join("triagebot.toml");
23+
path.canonicalize().unwrap_or(path)
24+
};
2525

2626
eprintln!("Checking file {path:?}\n");
2727

@@ -85,5 +85,7 @@ fn main() {
8585
let result = if failed == 0 { "ok" } else { "FAILED" };
8686
eprintln!("test result: {result}. {passed} passed; {failed} failed;");
8787

88-
process::exit(failed as i32);
88+
if failed > 0 {
89+
process::exit(1);
90+
}
8991
}

0 commit comments

Comments
 (0)