Skip to content

Updating Github API that now fetching co-authored using custom query#2382

Draft
PothieuG wants to merge 14 commits intomainfrom
2358-Rules_not_beeing_updated_to_SSW_People
Draft

Updating Github API that now fetching co-authored using custom query#2382
PothieuG wants to merge 14 commits intomainfrom
2358-Rules_not_beeing_updated_to_SSW_People

Conversation

@PothieuG
Copy link
Member

@PothieuG PothieuG commented Jan 26, 2026

Description

  • Add GraphQL query to fetch TinaCMS bot PRs with commit messages
  • Add searchTinaBotPRs method to extract co-authors
  • Update last-modified API to merge direct PRs and TinaCMS co-authored PRs

Screenshot (optional)

N/A

@PothieuG PothieuG enabled auto-merge (squash) January 26, 2026 14:58
@PothieuG PothieuG requested a review from Aibono1225 January 26, 2026 14:58
@PothieuG PothieuG marked this pull request as draft January 28, 2026 07:23
auto-merge was automatically disabled January 28, 2026 07:23

Pull request was converted to draft

@PothieuG PothieuG changed the title Updating Github API that now fetching co-authored using custom query WIP - Updating Github API that now fetching co-authored using custom query Jan 28, 2026
@PothieuG PothieuG marked this pull request as ready for review February 2, 2026 08:58
@PothieuG PothieuG changed the title WIP - Updating Github API that now fetching co-authored using custom query Updating Github API that now fetching co-authored using custom query Feb 2, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

🚀 PR Preview Deployed

Preview URL https://app-sswrules-staging-pr-2382.azurewebsites.net/rules
Slot Name pr-2382
Branch 2358-Rules_not_beeing_updated_to_SSW_People
Commit 66db7203ad75593d0a3166742523b16204690538

This preview will be automatically deleted when the PR is closed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 selectLatestRuleFilesByPath utility 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.

const allPRs: any[] = [];
const seenPRNumbers = new Set<number>();
let cursor: string | null = null;
const maxPages = 500;
Copy link
Member

Choose a reason for hiding this comment

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

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..)

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.

2 participants