Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
23 changes: 15 additions & 8 deletions scripts/detect_ci_task_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
)
Expand All @@ -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:
Expand Down
Loading