ci: pin Protocol verification actions
Verify Protocol / module (push) Successful in 26s
Verify Protocol / verify (push) Canceled after 0s

This commit is contained in:
sechmachine
2026-07-30 18:33:35 +07:00
parent 03e14a9ae3
commit d1d00d6472
3 changed files with 27 additions and 5 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env python3
"""Require immutable commits for third-party Gitea workflow actions."""
from __future__ import annotations
import pathlib
import re
ROOT = pathlib.Path(__file__).resolve().parents[1]
USE = re.compile(r"^\s*-\s+uses:\s+([^@\s]+)@([^\s#]+)", re.MULTILINE)
for workflow in sorted((ROOT / ".gitea/workflows").glob("*.y*ml")):
for action, revision in USE.findall(workflow.read_text(encoding="utf-8")):
if not action.startswith("./") and not re.fullmatch(r"[0-9a-f]{40}", revision):
raise SystemExit(f"{workflow.relative_to(ROOT)}: mutable action {action}@{revision}")
print("Protocol CI action references are immutable")