Skip to content

Conversation

@setchy
Copy link
Member

@setchy setchy commented Dec 20, 2025

Continuing from the refactoring of Discussions enrichment via GraphQL, this PR brings the same goodness but for Issues and Pull Requests.

Along the way we've been able to simplify custom handcrafted types, improve test cases to resemble actual responses, simplify enrichment logic and importantly reduce API calls

Signed-off-by: Adam Setch <adam.setch@outlook.com>
@github-actions github-actions bot added the refactor Refactoring of existing feature label Dec 20, 2025
@setchy setchy changed the title refactor(api): use graphql api for issue and pull request enrichment [WIP] refactor(api): use graphql api for issue and pull request enrichment Dec 20, 2025
@github-actions github-actions bot removed the refactor Refactoring of existing feature label Dec 20, 2025
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
@setchy setchy changed the title [WIP] refactor(api): use graphql api for issue and pull request enrichment refactor(api): use graphql api for issue and pull request enrichment Dec 22, 2025
@github-actions github-actions bot added the refactor Refactoring of existing feature label Dec 22, 2025
@setchy setchy marked this pull request as ready for review December 22, 2025 12:22
@setchy setchy requested a review from Copilot December 22, 2025 12:41
Copy link

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 refactors issue and pull request enrichment to use GitHub's GraphQL API instead of multiple REST API calls, following the same pattern previously established for discussion enrichment. The changes simplify type definitions, reduce API calls, and improve test accuracy by using GraphQL response structures.

Key Changes

  • Migrated issue and pull request enrichment from REST API to GraphQL API, reducing multiple API calls to single GraphQL queries
  • Consolidated type definitions by moving GitifySubject and related types from typesGitHub.ts to types.ts and leveraging GraphQL-generated types
  • Standardized state representations from lowercase strings (e.g., 'open', 'closed') to uppercase enums (e.g., 'OPEN', 'CLOSED') to align with GraphQL schema

Reviewed changes

Copilot reviewed 47 out of 49 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/renderer/types.ts Added Gitify notification types including GitifySubject, GitifyNotificationState, and related type unions using GraphQL-generated types
src/renderer/typesGitHub.ts Removed custom type definitions that are now handled by GraphQL types or moved to types.ts
src/renderer/utils/api/client.ts Removed REST API functions for issues and PRs, added GraphQL fetch functions fetchIssueByNumber and fetchPullByNumber
src/renderer/utils/api/graphql/*.graphql Added issue.graphql and pull.graphql queries, extracted common AuthorFields fragment to common.graphql
src/renderer/utils/notifications/handlers/issue.ts Refactored to use GraphQL API, simplified enrichment logic, added defaultUrl method
src/renderer/utils/notifications/handlers/pullRequest.ts Refactored to use GraphQL API, simplified review aggregation, added defaultUrl method
src/renderer/utils/notifications/handlers/*.ts Updated other handlers to use new types, add defaultUrl methods, and use getNotificationAuthor helper
src/renderer/utils/notifications/handlers/utils.ts Renamed getSubjectUser to getNotificationAuthor for clarity
src/renderer/utils/helpers.ts Simplified generateGitHubWebUrl to use handler's defaultUrl method and prefer subject.htmlUrl when available
src/renderer/utils/notifications/filters/state.ts Updated state filter arrays to use uppercase enum values
**/*.test.ts Updated tests to use GraphQL response structures and uppercase state values
codegen.ts Added enumsAsTypes config to generate TypeScript union types instead of enums
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Copy link

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

Copilot reviewed 47 out of 49 changed files in this pull request and generated 1 comment.

Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Copy link

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

Copilot reviewed 47 out of 49 changed files in this pull request and generated no new comments.

Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
Signed-off-by: Adam Setch <adam.setch@outlook.com>
@setchy
Copy link
Member Author

setchy commented Dec 22, 2025

Some anecdotal stats - inbox of 30 notifications, mixture of Issue, PR, Discussion, Release and Check Suite Runs
Screenshot 2025-12-23 at 6 36 08 AM

Before (REST APIs for Issues, PRs, Disucssions)
Screenshot 2025-12-23 at 6 32 25 AM

After (GraphQL APIs)
Screenshot 2025-12-23 at 6 33 20 AM

Signed-off-by: Adam Setch <adam.setch@outlook.com>
@setchy setchy merged commit 1ba7d24 into main Dec 22, 2025
14 checks passed
@setchy setchy deleted the refactor/fetch-issue-graphql branch December 22, 2025 23:55
@github-actions github-actions bot added this to the Release 6.15.0 milestone Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Refactoring of existing feature

2 participants