diff --git a/.github/scripts/test_text_guard.py b/.github/scripts/test_text_guard.py index f2f84e47..562fa492 100644 --- a/.github/scripts/test_text_guard.py +++ b/.github/scripts/test_text_guard.py @@ -53,6 +53,24 @@ def test_ulid_run_ids(self): self.assertEqual(rules("a 26-digit number 12345678901234567890123456"), set()) self.assertEqual(rules("too long 01JD8ZQ4M3T7KXW2B9RVNHC6PAX"), set()) + def test_coderhelm_ci_and_run_urls_are_ignored(self): + actions = ( + "- [`Lint & Build`]" + "(https://github.com/CoderHelm/coderhelm/actions/runs/46580354258/job/142414691790): running" + ) + self.assertEqual(rules(actions), set()) + run_page = "The rest of the notes are on the [run page](https://app.coderhelm.ai/runs/01JD8ZQ4M3T7KXW2B9RVNHC6PA)." + self.assertEqual(rules(run_page), set()) + built = "Plan, steps and logs: [the run page](https://app.coderhelm.com/runs/detail?id=01M8QY2KBNKJ7H0259BEYP5SRV)." + self.assertEqual(rules(built), set()) + footer = "Opened by CoderHelm \u00b7 [run log](https://app.coderhelm.com/runs/detail?id=01M8QY2KBNKJ7H0259BEYP5SRV)" + self.assertEqual(rules(footer), set()) + # A bare 12-digit number or ULID, outside such a URL, still trips. + self.assertEqual(rules("job 142414691790 ran"), {"12-digit number"}) + self.assertEqual(rules("run 01JD8ZQ4M3T7KXW2B9RVNHC6PA failed"), {"ULID run id"}) + # Another host's URL is not excused. + self.assertIn("AWS account id", rules("https://418273645091.dkr.ecr.us-east-1.amazonaws.com/x")) + def test_jira_keys_and_allowlist(self): self.assertEqual(rules("Closes QXZ-4821"), {"Jira-style key"}) self.assertEqual(rules("branch coderhelm/QXZ-48"), {"Jira-style key"}) diff --git a/.github/scripts/text_guard.py b/.github/scripts/text_guard.py index 89e1e5bf..c3e2861a 100644 --- a/.github/scripts/text_guard.py +++ b/.github/scripts/text_guard.py @@ -59,6 +59,22 @@ RE_TEAM = re.compile(r"TEAM#[0-9A-Za-z][0-9A-Za-z_-]*") RE_ULID = re.compile(r"(?