Skip to content

Commit 296e0a3

Browse files
committed
cleanup old code, add tests for check_pr logic
1 parent 9b9ef03 commit 296e0a3

4 files changed

Lines changed: 466 additions & 50 deletions

File tree

BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,5 @@ use_format_targets()
6868
exports_files([
6969
"MODULE.bazel",
7070
"pyproject.toml",
71+
"known_good.json",
7172
])

scripts/tooling/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ score_py_pytest(
6464
srcs = glob(["tests/**/*.py"]),
6565
data = [
6666
":cli/misc/assets/report_template.html",
67+
"//:known_good.json",
6768
],
6869
pytest_config = "//:pyproject.toml",
6970
deps = [

scripts/tooling/cli/release/check_approvals.py

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -530,56 +530,7 @@ def _run(args: argparse.Namespace) -> int:
530530

531531

532532
def main() -> None:
533-
"""Main entry point.
534-
535-
Runs approval check using environment variables:
536-
Required:
537-
- REPO_OWNER: Repository owner (e.g., 'eclipse-score')
538-
- REPO_NAME: Repository name (e.g., 'reference_integration')
539-
- PR_NUMBER: Pull request number
540-
- GITHUB_TOKEN: GitHub authentication token
541-
542-
Optional:
543-
- BASE_BRANCH: Target branch name (defaults to 'unknown')
544-
"""
545-
# Parse common arguments
546-
parser = argparse.ArgumentParser(
547-
description="Check release branch PR approvals",
548-
epilog="Primary usage: Set environment variables and run without arguments",
549-
)
550-
parser.add_argument(
551-
"--known_good",
552-
type=Path,
553-
default=_find_repo_root() / "known_good.json",
554-
help="Path to known_good.json file (default: repo_root/known_good.json)",
555-
)
556-
subparsers = parser.add_subparsers(dest="command", help="Debug commands")
557-
558-
# fetch-maintainers command (for debugging)
559-
subparsers.add_parser("fetch-maintainers", help="Fetch and print maintainers JSON")
560-
561-
args = parser.parse_args()
562-
563-
# Check if running in GitHub Actions (primary use case)
564-
if all(var in os.environ for var in ["REPO_OWNER", "REPO_NAME", "PR_NUMBER", "GITHUB_TOKEN"]):
565-
sys.exit(cmd_check_all(args.known_good))
566-
else:
567-
# Fallback for standalone/debug usage
568-
if args.command == "fetch-maintainers":
569-
cmd_fetch_maintainers(args.known_good)
570-
else:
571-
parser.print_help()
572-
print("\n" + "=" * 60)
573-
print("ERROR: Missing required environment variables")
574-
print("=" * 60)
575-
print("Required environment variables:")
576-
print(" - REPO_OWNER: Repository owner")
577-
print(" - REPO_NAME: Repository name")
578-
print(" - PR_NUMBER: Pull request number")
579-
print(" - GITHUB_TOKEN: GitHub authentication token")
580-
print("\nOptional:")
581-
print(" - BASE_BRANCH: Target branch (defaults to 'unknown')")
582-
sys.exit(1)
533+
print("This script should be run via `bazel` as part of CICD")
583534

584535

585536
if __name__ == "__main__":

0 commit comments

Comments
 (0)