File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1346,6 +1346,9 @@ def check_workflow_inventory(directory: Path) -> list[Path]:
13461346 "workflow inventory does not match the reviewed contract "
13471347 f"(missing: { missing } ; unexpected: { unexpected } )"
13481348 )
1349+ for path in paths :
1350+ if path .is_symlink () or not path .is_file ():
1351+ raise CheckError (f"{ path .name } : reviewed workflows must be regular, non-symlink files" )
13491352 return paths
13501353
13511354
Original file line number Diff line number Diff line change @@ -1166,6 +1166,19 @@ def test_workflow_inventory_rejects_unreviewed_workflow(tmp_path: Path) -> None:
11661166 check_workflow_inventory (tmp_path )
11671167
11681168
1169+ def test_workflow_inventory_rejects_expected_name_symlink (tmp_path : Path ) -> None :
1170+ workflow_root = tmp_path / "workflows"
1171+ workflow_root .mkdir ()
1172+ for name in ("live-smoke.yml" , "publish.yml" , "release-please.yml" ):
1173+ (workflow_root / name ).write_text ("name: reviewed\n " , encoding = "utf-8" )
1174+ outside = tmp_path / "outside-ci.yml"
1175+ outside .write_text ("name: outside\n " , encoding = "utf-8" )
1176+ (workflow_root / "ci.yml" ).symlink_to (outside )
1177+
1178+ with pytest .raises (RuntimeError , match = "regular, non-symlink files" ):
1179+ check_workflow_inventory (workflow_root )
1180+
1181+
11691182def test_secret_scope_scan_includes_yaml_workflows (tmp_path : Path ) -> None :
11701183 workflow_root = tmp_path / ".github/workflows"
11711184 workflow_root .mkdir (parents = True )
You can’t perform that action at this time.
0 commit comments