Skip to content

Commit 2014f07

Browse files
committed
ci: recognize inline #[cfg(test)] tests and fix triage comment grammar
1 parent fabbf6c commit 2014f07

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎.github/workflows/pr-triage.yml‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,13 @@ jobs:
6464
if (isFork && touchesWorkflows) want.add("workflow-change");
6565
6666
const changedRust = names.some(n => n.startsWith("crates/") && n.endsWith(".rs"));
67-
const touchedTests = names.some(n => n.includes("/tests/") || n.endsWith("_test.rs"));
67+
// A test can live in a tests/ dir, a *_test.rs file, or — the common Rust
68+
// pattern — an inline #[test] / #[cfg(test)] block added inside the source file.
69+
const addsInlineTest = files.some(f =>
70+
f.filename.endsWith(".rs") && f.patch &&
71+
/^\+.*#\[(test\]|cfg\(test\))/m.test(f.patch));
72+
const touchedTests =
73+
names.some(n => n.includes("/tests/") || n.endsWith("_test.rs")) || addsInlineTest;
6874
if (changedRust && !touchedTests) want.add("needs-tests");
6975
7076
// Reconcile labels: add wanted managed labels, remove managed labels no longer wanted.
@@ -108,7 +114,7 @@ jobs:
108114
"",
109115
lines,
110116
"",
111-
"See [CONTRIBUTING.md](https://github.com/Gitlawb/node/blob/main/CONTRIBUTING.md). Update the PR and these notes clear automatically.",
117+
"See [CONTRIBUTING.md](https://github.com/Gitlawb/node/blob/main/CONTRIBUTING.md). Update the PR and these notes will clear automatically.",
112118
].join("\n");
113119
114120
await github.rest.issues.createComment({ owner, repo, issue_number: prNumber, body: comment });

0 commit comments

Comments
 (0)