diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e4695ce3..325de3d8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,6 @@ jobs: task_scoped: ${{ steps.detect.outputs.task_scoped }} steps: - uses: actions/checkout@v7 - if: ${{ github.event_name == 'pull_request' }} with: fetch-depth: 0 - name: Detect CI task scope @@ -33,14 +32,8 @@ jobs: BASE_SHA: ${{ github.event.pull_request.base.sha }} HEAD_SHA: ${{ github.event.pull_request.head.sha }} run: | - if [ "$EVENT_NAME" != "pull_request" ]; then - echo "ppc_tasks=all" >> "$GITHUB_OUTPUT" - echo "task_scoped=false" >> "$GITHUB_OUTPUT" - echo "PPC_TASKS=all" - exit 0 - fi - python3 scripts/detect_ci_task_scope.py \ + --event-name "$EVENT_NAME" \ --base-sha "$BASE_SHA" \ --head-sha "$HEAD_SHA" \ --github-output "$GITHUB_OUTPUT" diff --git a/scripts/detect_ci_task_scope.py b/scripts/detect_ci_task_scope.py index 2439d511..81550b90 100644 --- a/scripts/detect_ci_task_scope.py +++ b/scripts/detect_ci_task_scope.py @@ -52,14 +52,15 @@ def _write_github_output(github_output: Path, scope: str, task_scoped: bool) -> def _parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser( - description="Detect the PPC_TASKS value for CI from changed PR paths.", + description="Detect the PPC_TASKS value for CI.", ) parser.add_argument( - "--base-sha", required=True, help="Base commit for the PR diff." - ) - parser.add_argument( - "--head-sha", required=True, help="Head commit for the PR diff." + "--event-name", + default="pull_request", + help="GitHub event name. Non-PR events always run the full suite.", ) + parser.add_argument("--base-sha", help="Base commit for the PR diff.") + parser.add_argument("--head-sha", help="Head commit for the PR diff.") parser.add_argument( "--tasks-root", default="tasks", type=Path, help="Path to the tasks directory." ) @@ -73,9 +74,15 @@ def _parse_args() -> argparse.Namespace: def main() -> None: args = _parse_args() - scope, task_scoped = detect_scope( - _changed_files(args.base_sha, args.head_sha), args.tasks_root - ) + if args.event_name != "pull_request": + scope, task_scoped = FULL_SUITE, False + else: + if args.base_sha is None or args.head_sha is None: + msg = "--base-sha and --head-sha are required for pull_request events" + raise SystemExit(msg) + scope, task_scoped = detect_scope( + _changed_files(args.base_sha, args.head_sha), args.tasks_root + ) print(f"PPC_TASKS={scope}") if args.github_output is not None: