ci(molecule): stop running every scenario for files no scenario reads
Build / build (pull_request) Canceled after 0s
Lint / lint (pull_request) Canceled after 0s
Molecule / molecule (pull_request) Canceled after 0s

A pull request ran every scenario when it changed the selector itself,
which happened whenever a new file was added to its IGNORED list.
Molecule runs the base branch's copy, so the pull request's copy is
never exercised by a scenario. Ignore it, nested AGENTS.md files, role
READMEs, .python-version and scripts/lock-requirements.sh.

Assisted-by: Claude Code:claude-opus-5-5
This commit is contained in:
Defame1297 committed 2026-11-22 20:09:08 +00:00
1 parent c60c6aa970
commit 00bac19705
2 files changed
+33 -4

No files matched your search

@@ -162,6 +162,32 @@ class SelectTest(unittest.TestCase):
chosen, _reason = sel.select(ALL, ["AGENTS.md"])
self.assertEqual(chosen, [])
def test_nested_agent_guidance_selects_nothing(self):
chosen, _reason = self.select(
[
".gitea/workflows/AGENTS.md",
"scripts/AGENTS.md",
"roles/docker/AGENTS.md",
],
)
self.assertEqual(chosen, [])
def test_role_readme_selects_nothing(self):
# A role's README is documentation; its scenarios and its users' do not read it.
chosen, _reason = self.select(["roles/docker/README.md"])
self.assertEqual(chosen, [])
def test_selector_and_dev_python_select_nothing(self):
# Molecule runs the base copy of the selector and the runner's own venv.
chosen, _reason = self.select(
[
"scripts/select_molecule_scenarios.py",
"scripts/lock-requirements.sh",
".python-version",
],
)
self.assertEqual(chosen, [])
def test_issue_and_pull_request_templates_select_nothing(self):
# Gitea reads them for its web forms; no scenario does, and they are not shipped.
chosen, _reason = self.select(
@@ -184,7 +210,6 @@ class SelectTest(unittest.TestCase):
"plugins/modules/x.py",
"extensions/molecule/image-smoke/molecule.yml",
".gitea/workflows/molecule.yml",
"scripts/select_molecule_scenarios.py",
"tests/unit/x.py",
"new_top_level_file",
"roles/README.md",