microsoft / microsoft/NativeAOTDependencyHelper

Use Octokit.GraphQL instead of Octokit for the performance aspects

Open
#13 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
45
Forks
6
Avg merge
16h 1m
Merged PRs (30d)
1

Description

According to the GitHubIssueSearchDataSource class, it possibly queries hundreds of issues using Octokit.NET.

https://github.com/microsoft/NativeAOTDependencyHelper/blob/ee7c92ada9c4e7ef6c91e9f5807bf99d462952e0/NativeAOTDependencyHelper.Core/Sources/GitHubIssueSearchDataSource.cs#L66

However, GitHub API v3 (or Octokit or REST API) is not recommended where GitHub API v4 (or Octokit.GraphQL or GraphLQ API) is available since it queries the whole information at the API endpoint even if you don't request.

https://github.com/octokit/octokit.graphql.net

> dotnet add package Octokit.GraphQL

This GraphQL source does a query for a word AOT in the title of issues on CommunityToolkit/Windows.
Try run this in https://docs.github.com/en/graphql/overview/explorer

query
{
    search(
        query: "repo:CommunityToolkit/Windows is:issue in:title AOT",
        type: ISSUE,
        first: 1)
    {
        issueCount
    }
}
var connection = new Connection(new ProductHeaderValue("NativeAOTDependencyHelper"), "ACCESS_TOKEN");

var query = new Query()
    .Search("repo:microsoft/terminal is:issue in:title AOT", SearchType.Issue, first: 1)
    .Select(search => new
    {
        // No other data is queried or returned
        search.IssueCount,
    });

var response = await connection.Run(query);

var issueCount = response.IssueCount;

This is equivalent to:
https://github.com/search?q=repo%3ACommunityToolkit%2FWindows+is%3Aissue+in%3Atitle+AOT&type=issues
if you'd like to change the URL for users to visit:
https://github.com/microsoft/NativeAOTDependencyHelper/blob/ee7c92ada9c4e7ef6c91e9f5807bf99d462952e0/NativeAOTDependencyHelper.Core/Sources/GitHubIssueSearchDataSource.cs#L63

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in NativeAOTDependencyHelper.Core/Sources/GitHubIssueSearchDataSource.cs around lines 63-66 and inspect how Octokit queries GitHub issues. Compare that call with the provided Octokit.GraphQL example, then verify that the issue-count behavior remains equivalent and that the resulting query requests only the needed data.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, github, graphql
Domain
api, tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.