Updating Github API that now fetching co-authored using custom query#2382
Updating Github API that now fetching co-authored using custom query#2382
Conversation
# Conflicts: # tina/tina-lock.json
…edAt, removing the cache
Pull request was converted to draft
… by checking commit authors' GitHub login
…58-Rules_not_beeing_updated_to_SSW_People
# Conflicts: # tina/tina-lock.json
…58-Rules_not_beeing_updated_to_SSW_People
🚀 PR Preview Deployed
This preview will be automatically deleted when the PR is closed. |
There was a problem hiding this comment.
Pull request overview
This PR enhances the GitHub API integration to fetch pull requests from both direct user contributions and TinaCMS bot PRs where the user is listed as a co-author. This allows the system to properly attribute rules modified through the TinaCMS interface to their actual authors rather than just the bot.
Changes:
- Added a new GraphQL query (
GITHUB_TINA_BOT_PRS_QUERY) to fetch TinaCMS bot PRs with commit author information - Implemented methods to search for user contributions in both direct PRs and TinaCMS bot PRs by examining commit authors and messages
- Refactored the last-modified API endpoint to use the new combined PR search and removed caching
- Updated the
selectLatestRuleFilesByPathutility to handle mergedAt timestamps for deduplication
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 21 comments.
| File | Description |
|---|---|
| lib/services/github/github.constants.ts | Added new GraphQL query for TinaCMS bot PRs with commit and author details; increased file limit from 6 to 20 |
| lib/services/github/github.service.ts | Added retry logic, methods for searching direct and TinaCMS bot PRs, and combined PR fetching; removed typed interfaces in favor of any types |
| app/api/rules/last-modified/route.ts | Refactored to use new getPRsForUser method; removed caching and simplified PR processing logic |
| utils/selectLatestRuleFilesByPath.ts | Updated to normalize paths and handle mergedAt timestamps for deduplication |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…s, better error handling
| const allPRs: any[] = []; | ||
| const seenPRNumbers = new Set<number>(); | ||
| let cursor: string | null = null; | ||
| const maxPages = 500; |
There was a problem hiding this comment.
maxPages = 500 - Is there a specific reason for choosing this number?
I'm wondering if this could cause high GraphQL cost or rate-limit issues when th euser has only few or no matching PRs (for example Ana, Griffen..)
…ew last-modified endpoint.
Description
Screenshot (optional)
N/A