File tree Expand file tree Collapse file tree 2 files changed +7
-11
lines changed
Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -93,12 +93,11 @@ for ISSUE in $ISSUES; do
9393 continue
9494 fi
9595
96- # Use the same "max by timestamp " logic as the real bot
97- COMMITS_JSON=$( gh api " repos/$REPO /pulls/$PR_NUM /commits" 2> /dev/null || echo " " )
96+ # Use the same "last commit " logic as the real bot (with pagination)
97+ COMMITS_JSON=$( gh api " repos/$REPO /pulls/$PR_NUM /commits" --paginate 2> /dev/null || echo " " )
9898
9999 LAST_COMMIT_DATE=$( echo " $COMMITS_JSON " \
100- | jq -r ' max_by(.commit.committer.date // .commit.author.date)
101- | (.commit.committer.date // .commit.author.date)' 2> /dev/null || echo " " )
100+ | jq -r ' last | (.commit.committer.date // .commit.author.date)' 2> /dev/null || echo " " )
102101
103102 if [ -z " $LAST_COMMIT_DATE " ] || [ " $LAST_COMMIT_DATE " = " null" ]; then
104103 echo " [WARN] Could not determine last commit date for PR #$PR_NUM , skipping."
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22set -euo pipefail
33
4+ # Inactivity Unassign Bot (Phase 2 - PR inactivity)
45# Env:
56# GH_TOKEN - provided by GitHub Actions
67# REPO - owner/repo (fallback to GITHUB_REPOSITORY)
@@ -94,15 +95,11 @@ for ISSUE in $ISSUES; do
9495 continue
9596 fi
9697
97- # Last commit date on the PR: pick the truly latest by timestamp
98- COMMITS_JSON=$( gh api " repos/$REPO /pulls/$PR_NUM /commits" --paginate 2> /dev/null || echo " [] " )
98+ # Last commit date on the PR (use API order + paginate, take last)
99+ COMMITS_JSON=$( gh api " repos/$REPO /pulls/$PR_NUM /commits" --paginate 2> /dev/null || echo " " )
99100
100101 LAST_COMMIT_DATE=$( echo " $COMMITS_JSON " \
101- | jq -r '
102- select(length > 0)
103- | max_by(.commit.committer.date // .commit.author.date)
104- | (.commit.committer.date // .commit.author.date)
105- ' )
102+ | jq -r ' last | (.commit.committer.date // .commit.author.date)' 2> /dev/null || echo " " )
106103
107104 if [ -z " $LAST_COMMIT_DATE " ] || [ " $LAST_COMMIT_DATE " = " null" ]; then
108105 echo " [WARN] Could not determine last commit date for PR #$PR_NUM , skipping."
You can’t perform that action at this time.
0 commit comments