Skip to content

docs-review: simplify changed-file discovery with gh pr diff - #154

Merged
theletterf merged 1 commit into
mainfrom
brassy-banana
May 14, 2026
Merged

theletterf merged 1 commit into
mainfrom
brassy-banana

Conversation

@reakaleek

Copy link
Copy Markdown
Member

What

Replace the 29-line GraphQL cursor-pagination loop (added in #153) with three lines using gh pr diff <N> --name-only.

Why

The GraphQL loop was overengineered for the problem it solved. The actual root-cause fix in #153 was set -euo pipefail catching previously-silent pipeline failures. The manual cursor bookkeeping, duplicate query strings, and three jq passes per page are unnecessary — gh handles pagination internally.

How

gh pr diff "$PR_NUMBER" --name-only prints one path per line for all changed files, then awk '/\.md$/' filters to markdown. Deleted files are no longer explicitly excluded at discovery time, but the existing [ -f "$f" ] || continue guard in the copy loop (which runs after git checkout --detach to the PR head) excludes them naturally since deleted files don't exist on the PR head. The only behavioral difference is that a PR touching only deleted markdown files will do one extra git fetch before the ELIGIBLE_COUNT=0 guard noops it — accepted.

All other changes from #153 (set -euo pipefail, review-scope prompt echo, Vale/style-guide wording) are kept as-is.

Test plan

  • gh aw compile — passes (run locally, lock file committed)
  • gh aw validate — passes
  • Trigger /docs-review on a test PR with: added .md files, modified .md files, a deleted .md file, a renamed .md file — confirm eligible-files.txt matches expected scope under both docs-subtree and repo-wide-markdown

Notes

Net: −52 lines in the lock file, −26 lines in the source .md.

Replace the 29-line GraphQL cursor-pagination loop from #153 with a
three-line `gh pr diff <N> --name-only` call. gh handles pagination
internally, so the manual NEXT_CURSOR bookkeeping and duplicate query
strings are no longer needed.

Deleted files are no longer filtered at discovery time, but the existing
`[ -f "$f" ] || continue` guard in the copy loop (which runs after
git checkout to the PR head) excludes them naturally. The only behavioral
difference is that a PR touching only deleted markdown files will do one
extra git fetch before nooping via the ELIGIBLE_COUNT=0 guard.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@reakaleek
reakaleek requested a review from a team as a code owner May 13, 2026 20:35
@reakaleek
reakaleek requested review from technige and theletterf May 13, 2026 20:35
@reakaleek reakaleek added enhancement New feature or request chore and removed enhancement New feature or request labels May 13, 2026

@theletterf theletterf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@theletterf
theletterf merged commit c9f2517 into main May 14, 2026
5 of 6 checks passed
@theletterf
theletterf deleted the brassy-banana branch May 14, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants