Enhance PR and issue tracking in contributions script #1394
+21
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The
contributions-for-user.shscript was incorrectly reporting pull requests as issues, leading to:Before this change: 0 PRs tracked, 11 items in issues (most were actually PRs) (Reference: https://gist.github.com/anujc25/ddbf3c6c686e0fa1028c72b3584c1ede)
After this change: 26 PRs properly tracked, 1 actual issue (Reference: https://gist.github.com/anujc25/f2e7ab6b2e1129769ce9f1d8003324b3)
Solution
Use GitHub Search API to find PR reviews and comments (provides complete history, not just last 90 days)
search/issues?q=repo:${repo}+type:pr+reviewed-by:${user}- finds official reviewssearch/issues?q=repo:${repo}+type:pr+commenter:${user}- finds PR comment participationFilter PRs from issue queries using
select(.pull_request == null)to prevent PRs from appearing in the issues sectionKeep Events API as fallback for recent activity