Files
wehub-resource-sync 7a0da7932b
OSV-Scanner (Scheduled) / scan-scheduled (push) Failing after 0s
Create Release / test-gate (push) Has been cancelled
Create Release / release-gate (push) Has been cancelled
Create Release / ci-gate (push) Has been cancelled
Create Release / version-check (push) Has been cancelled
Create Release / e2e-test-gate (push) Has been cancelled
Create Release / responsive-test-gate (push) Has been cancelled
Create Release / compat-test-gate (push) Has been cancelled
Create Release / compose-integration-gate (push) Has been cancelled
Create Release / vulture-gate (push) Has been cancelled
Create Release / build (push) Has been cancelled
Create Release / provenance (push) Has been cancelled
Create Release / prerelease-docker (push) Has been cancelled
Create Release / publish-docker (push) Has been cancelled
Create Release / create-release (push) Has been cancelled
Create Release / cleanup-changelog (push) Has been cancelled
Create Release / trigger-pypi (push) Has been cancelled
Create Release / monitor-pypi (push) Has been cancelled
Create Release / Clean up orphan prerelease tags and signatures (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-form] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-metrics] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-workflow] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-core] (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [history-news] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [library] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [link-analytics] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-core] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-lifecycle] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [error-benchmark] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-pages] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) (push) Has been cancelled
Docker Tests (Consolidated) / Accessibility Tests (push) Has been cancelled
Docker Tests (Consolidated) / LLM Unit Tests (push) Has been cancelled
Docker Tests (Consolidated) / LLM Example Tests (push) Has been cancelled
Docker Tests (Consolidated) / Production Image Smoke Test (push) Has been cancelled
Docker Tests (Consolidated) / Infrastructure Tests (push) Has been cancelled
OSSF Scorecard / OSSF Security Scorecard Analysis (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [mobile] (push) Has been cancelled
Backwards Compatibility / Verify Encryption Constants (push) Has been cancelled
Backwards Compatibility / PyPI Version Compatibility (push) Has been cancelled
Backwards Compatibility / Database Migration Tests (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Docker Tests (Consolidated) / detect-changes (push) Has been cancelled
Docker Tests (Consolidated) / Build Test Image (push) Has been cancelled
Docker Tests (Consolidated) / All Pytest Tests + Coverage (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [accessibility] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [api-crud] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-login] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-pages] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-register] (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:08:55 +08:00

80 lines
2.3 KiB
Python
Executable File

#!/usr/bin/env python3
"""Check that the hardcoded CODEOWNERS list in pr-triage.yml matches
the global owners line in .github/CODEOWNERS."""
import re
import sys
from pathlib import Path
def main():
root = Path(__file__).parent.parent
codeowners_file = root / ".github" / "CODEOWNERS"
workflow_file = root / ".github" / "workflows" / "pr-triage.yml"
if not codeowners_file.exists() or not workflow_file.exists():
return 0
try:
codeowners_text = codeowners_file.read_text(encoding="utf-8")
workflow_text = workflow_file.read_text(encoding="utf-8")
except OSError as e:
print(f"ERROR: Could not read file: {e}")
return 1
global_owners = None
for line in codeowners_text.splitlines():
stripped = line.strip()
if not stripped or stripped.startswith("#"):
continue
if stripped.startswith("* "):
global_owners = re.findall(r"@([A-Za-z0-9][A-Za-z0-9-]*)", stripped)
break
if not global_owners:
print(
"ERROR: Could not find a '* @owner...' global owners line "
"in .github/CODEOWNERS"
)
return 1
match = re.search(
r"const\s+CODEOWNERS\s*=\s*\[([^\]]*)\]",
workflow_text,
)
if match is None:
print(
"ERROR: Could not find 'const CODEOWNERS = [...]' "
"in .github/workflows/pr-triage.yml"
)
return 1
js_owners = re.findall(
r"['\"]([A-Za-z0-9][A-Za-z0-9-]*)['\"]", match.group(1)
)
co_set = {u.lower() for u in global_owners}
js_set = {u.lower() for u in js_owners}
if co_set != js_set:
print("ERROR: CODEOWNERS list mismatch between files.")
print(f" .github/CODEOWNERS global owners: {sorted(global_owners)}")
print(f" pr-triage.yml CODEOWNERS const: {sorted(js_owners)}")
only_in_co = co_set - js_set
only_in_js = js_set - co_set
if only_in_co:
print(f" Only in CODEOWNERS: {sorted(only_in_co)}")
if only_in_js:
print(f" Only in pr-triage.yml: {sorted(only_in_js)}")
print(
"Update both lists so they share the same maintainers "
"(comments in each file note this requirement)."
)
return 1
return 0
if __name__ == "__main__":
sys.exit(main())