Skip to content

fix: use pulls.listFiles API for PR changed files - #76

Merged
aGallea merged 2 commits into
masterfrom
fix/use-pulls-api-for-changed-files
Mar 25, 2026
Merged

fix: use pulls.listFiles API for PR changed files#76
aGallea merged 2 commits into
masterfrom
fix/use-pulls-api-for-changed-files

Conversation

@aGallea

@aGallea aGallea commented Mar 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Use pulls.listFiles API for PR events instead of compareCommitsWithBasehead — avoids 404 errors caused by URL encoding of branch names with / (e.g. fix/somethingfix%2Fsomething)
  • Keep compareCommitsWithBasehead as fallback for push events only
  • Wrap getChangedFiles in try-catch so coverage report still posts even if changed file detection fails

Test Plan

  • All 78 existing tests pass
  • Updated mocks to use pulls.listFiles for PR event tests

🤖 Generated with Claude Code

The compareCommitsWithBasehead API can return 404 for PRs,
likely due to URL encoding of branch names containing slashes
(e.g. fix/something becomes fix%2Fsomething in the API path).

Switch to pulls.listFiles for PR events, which uses the PR
number instead of branch names and is the canonical API for
getting PR changed files. Keep compareCommitsWithBasehead as
fallback for push events.

Also wrap getChangedFiles in try-catch in main.ts so the
coverage report still posts even if changed file detection
fails (just without diff coverage).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Mar 25, 2026

Copy link
Copy Markdown

Tests Report 📄

Tests Success ✅

JUnit Details

Total Tests Failures Errors Skipped Time ⏳
83 0 0 0 19.09s

Coverage Details (99% >= 80%) ✅

Diff Cover Details
FileCovered LinesMissing Lines
src/changedFiles.ts56/56100%
src/eventInfo.ts2/2100%
src/main.ts18/18100%
src/types.d.ts0/10%32
Total76/7799%

…handling

- Test compareCommitsWithBasehead path (push events without prNumber)
- Test pagination for compareCommitsWithBasehead
- Test undefined files response in compareCommitsWithBasehead
- Test empty refs returns empty result
- Test getChangedFiles failure in main.ts logs warning and continues

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aGallea
aGallea merged commit ec51509 into master Mar 25, 2026
3 checks passed
aGallea pushed a commit that referenced this pull request Mar 25, 2026
### Bug Fixes

* use pulls.listFiles API for PR changed files ([#76](#76)) ([ec51509](ec51509))
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