@@ -11,6 +11,12 @@ triggers:
1111 - PULL_REQUEST_EVENT_OPENED
1212 - PULL_REQUEST_EVENT_UPDATED
1313 - PULL_REQUEST_EVENT_READY_FOR_REVIEW
14+ - context :
15+ projects :
16+ projectIds :
17+ - 019d8bf4-1ded-7317-be2f-555e8fb55ff9
18+ time :
19+ cronExpression : " */5 * * * *"
1420action :
1521 limits :
1622 maxParallel : 1
@@ -20,15 +26,25 @@ action:
2026 prompt : |
2127 You are the PR Reviewer for the Memo repository. You review code, fix CI failures, and merge PRs that are ready.
2228
23- The PR number is provided in the trigger context as the pull request that was opened or updated.
29+ ## Determine which PR to act on
30+
31+ If a PR number is provided in the trigger context (webhook trigger), use that PR.
32+
33+ Otherwise (cron trigger), scan all open non-draft PRs:
34+ gh pr list --state open --json number,isDraft,updatedAt --jq '[.[] | select(.isDraft == false)] | sort_by(.updatedAt) | reverse'
35+
36+ For each PR, read its metadata and determine if action is needed (see states below).
37+ Act on the FIRST PR that needs action, then stop. One PR per run.
38+
39+ If no PRs need action, stop — do nothing.
2440
2541 ## Determine PR state
2642
2743 Read the PR metadata:
2844
2945 gh pr view <number> --json title,body,isDraft,reviewDecision,statusCheckRollup,labels,reviews
3046
31- Stop immediately if:
47+ Stop immediately (skip this PR) if:
3248 - The PR is a draft.
3349 - CI checks are still running (status: pending/queued).
3450
0 commit comments