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
52 changes: 32 additions & 20 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,24 +114,36 @@ jobs:
run: |
set -uo pipefail

# Check if Codex has been requested as a reviewer or has left comments.
# Exit codes: 0=approved, 1=comments to address, 10=no response yet.
if ./scripts/check_codex_comments.sh "$PR_NUMBER"; then
rc=0
else
rc=$?
fi
# Grace period: retry up to ~75s when Codex hasn't responded yet.
max_attempts=6
interval=15
attempt=0

case "$rc" in
0)
echo "✅ Codex review approved"
;;
10)
echo "⏳ Codex review not yet received — request one with: @codex review"
exit 1
;;
*)
echo "❌ Codex review has comments to address"
exit 1
;;
esac
while true; do
attempt=$((attempt + 1))

if ./scripts/check_codex_comments.sh "$PR_NUMBER"; then
rc=0
else
rc=$?
fi

case "$rc" in
0)
echo "✅ Codex review approved"
exit 0
;;
10)
if [ "$attempt" -ge "$max_attempts" ]; then
echo "⏳ Codex review not yet received after ${attempt} attempts — request one with: @codex review"
exit 1
fi
echo "⏳ No Codex response yet (attempt ${attempt}/${max_attempts}), retrying in ${interval}s..."
sleep "$interval"
;;
*)
echo "❌ Codex review has comments to address"
exit 1
;;
esac
done
4 changes: 2 additions & 2 deletions scripts/check_codex_comments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ fi

# Check for thumbs-up reaction from Codex bot (must be after latest push)
last_push=$(echo "$data" | jq -r \
'.data.repository.pullRequest.commits.nodes[-1].commit.pushedDate // empty')
'.data.repository.pullRequest.commits.nodes[-1].commit.pushedDate // ""')

has_thumbsup=$(echo "$data" | jq -r --arg bot "$BOT_LOGIN" --arg since "${last_push:-}" \
'[.data.repository.pullRequest.reactions.nodes[]?
| select(.user.login == $bot)
| select(.user.login | startswith($bot))
| select($since == "" or .createdAt > $since)
] | length')

Expand Down