mirror of
https://github.com/VectifyAI/PageIndex.git
synced 2026-04-24 23:56:21 +02:00
Merge pull request #132 from VectifyAI/fix/backfill-dedupe-pagination
Fix backfill-dedupe pagination: replace gh issue list with gh api
This commit is contained in:
commit
f7d6f62f61
1 changed files with 3 additions and 13 deletions
16
.github/workflows/backfill-dedupe.yml
vendored
16
.github/workflows/backfill-dedupe.yml
vendored
|
|
@ -37,19 +37,9 @@ jobs:
|
||||||
SINCE=$(date -u -d "$DAYS_BACK days ago" +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || date -u -v-${DAYS_BACK}d +%Y-%m-%dT%H:%M:%SZ)
|
SINCE=$(date -u -d "$DAYS_BACK days ago" +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || date -u -v-${DAYS_BACK}d +%Y-%m-%dT%H:%M:%SZ)
|
||||||
echo "Fetching open issues since $SINCE"
|
echo "Fetching open issues since $SINCE"
|
||||||
|
|
||||||
# Get open issues with pagination, filter out PRs and already-labeled ones
|
# Get open issues via gh api --paginate, filter out PRs and already-labeled ones
|
||||||
ISSUES=""
|
ISSUES=$(gh api --paginate "repos/$REPO/issues?state=open&per_page=100" \
|
||||||
PAGE=1
|
--jq "[.[] | select(.pull_request == null) | select(.created_at >= \"$SINCE\") | select([.labels[].name] | index(\"duplicate\") | not)] | .[].number" | xargs)
|
||||||
while true; do
|
|
||||||
RAW_COUNT=$(gh issue list --repo "$REPO" --state open --limit 100 --page "$PAGE" --json number | jq 'length')
|
|
||||||
BATCH=$(gh issue list --repo "$REPO" --state open --limit 100 --page "$PAGE" --json number,labels,createdAt \
|
|
||||||
--jq "[.[] | select(.createdAt >= \"$SINCE\") | select([.labels[].name] | index(\"duplicate\") | not)] | .[].number")
|
|
||||||
|
|
||||||
[ -n "$BATCH" ] && ISSUES="$ISSUES $BATCH"
|
|
||||||
[ "$RAW_COUNT" -lt 100 ] && break
|
|
||||||
PAGE=$((PAGE + 1))
|
|
||||||
done
|
|
||||||
ISSUES=$(echo "$ISSUES" | xargs)
|
|
||||||
|
|
||||||
if [ -z "$ISSUES" ]; then
|
if [ -z "$ISSUES" ]; then
|
||||||
echo "No issues to process"
|
echo "No issues to process"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue