Skip to content

fix(ci): repair monthly PR digest — gh pr list over gh search prs#25

Merged
damianrosellen1 merged 1 commit into
mainfrom
fix/monthly-digest-gh-pr-list
Jul 1, 2026
Merged

fix(ci): repair monthly PR digest — gh pr list over gh search prs#25
damianrosellen1 merged 1 commit into
mainfrom
fix/monthly-digest-gh-pr-list

Conversation

@damianrosellen1

Copy link
Copy Markdown
Contributor

Problem

The monthly Slack digest posted "No PRs opened or closed in this period." for every repo (VaultLens, mammalsandcomputers, farbstudio.de, bef-website-2026, next-sanity-starter) for June 2026 — despite dozens of real PRs.

Root cause: gh search prs runs over the issue-search API and does not expose mergedAt, additions, deletions, changedFiles, commits. It errors with Unknown JSON field: "mergedAt", and 2>/dev/null || echo '[]' swallowed that failure into []pr_count=0skip=true → the empty digest. Because the error is static (not repo-dependent), every repo reported zero.

Fix

  1. Query via gh pr list --search (GraphQL PR API), which supports the rich fields. Drop the 2>/dev/null || echo '[]' fallback so a genuinely failed query fails the job loudly instead of faking an empty month.
  2. Co-author tool attribution (Cursor/Claude/Copilot) now works:
    • the commits connection blows the GraphQL node limit in a bulk pr-list call → fetch commits per PR (cheap for a monthly job, failure-tolerant);
    • match Co-authored-by case-insensitively — Cursor writes Co-authored-by:, Claude writes Co-Authored-By:, so every Claude co-author was silently dropped before (on top of the .message field not existing — it's .messageBody).

One reusable workflow → fixes all caller repos at once.

Verification

Ran the full corrected Collect step against backendforth/next-sanity-starter for June 2026:

  • 59 PRs · 41 merged · +22,011 / −11,966 lines
  • author kind: 25 Dependabot / 34 Human
  • tools: Claude 27 · Cursor 25

digest-context.json is valid; workflow YAML validates.

After merge

Re-post June's digest immediately via each caller's workflow_dispatch (today is July 1 → "last month" still resolves to June).

🤖 Generated with Claude Code

The monthly digest posted "No PRs opened or closed in this period" for
every repo. `gh search prs` runs over the issue-search API and does not
expose mergedAt/additions/deletions/changedFiles/commits — it errored on
those --json fields, and `2>/dev/null || echo '[]'` swallowed the failure
into an empty result, so every run reported zero PRs.

- Query PRs via `gh pr list --search` (GraphQL PR API) instead of
  `gh search prs`; drop the error-swallowing fallback so a failed query
  fails the job loudly instead of faking an empty month.
- Fetch commit trailers per PR: the commits connection blows the GraphQL
  node limit in a bulk pr-list call. Match Co-authored-by case-insensitively
  (Cursor writes "Co-authored-by:", Claude "Co-Authored-By:") — Claude
  co-authors were previously dropped entirely.

Verified against backendforth/next-sanity-starter for June 2026: 59 PRs,
41 merged, +22011/-11966, 25 Dependabot / 34 Human, tools Claude 27 / Cursor 25.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant