Replace Octokit Release API with GraphQL queries using ReleaseNode#81
Replace Octokit Release API with GraphQL queries using ReleaseNode#81Malcolmnixon merged 7 commits intomainfrom
Conversation
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
src/DemaConsulting.BuildMark/RepoConnectors/GitHubRepoConnector.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
| /// <param name="owner">Repository owner.</param> | ||
| /// <param name="repo">Repository name.</param> | ||
| /// <returns>List of release tag names.</returns> | ||
| public async Task<List<string>> GetReleasesAsync( |
There was a problem hiding this comment.
Why not have this return a list of ReleaseNode records?
There was a problem hiding this comment.
Fixed in e2a22ca. Changed GetReleasesAsync to return List<ReleaseNode> directly, eliminating the intermediate string conversion.
| /// <param name="owner">Repository owner.</param> | ||
| /// <param name="repo">Repository name.</param> | ||
| /// <returns>List of all releases.</returns> | ||
| private static async Task<IReadOnlyList<Release>> GetAllReleasesAsync( |
There was a problem hiding this comment.
It seems there are two data types introduced - ReleaseNode and Release, and the code goes from ReleaseNode to string, to release. Don't add extra types and extra conversions.
There was a problem hiding this comment.
Fixed in e2a22ca. Removed the custom Release type and the extra conversions. Now GetReleasesAsync returns List<ReleaseNode> directly, and ReleaseNode is used throughout the application (in GitHubData, LookupData, etc.). The flow is now: GraphQL response → ReleaseNode → used directly.
…conversions Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
test/DemaConsulting.BuildMark.Tests/RepoConnectors/GitHub/GitHubGraphQLClientTests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Pull Request
Description
Replaces
client.Repository.Release.GetAll(owner, repo)REST API call with GraphQL implementation, following the established pattern for commits and issues queries. Completely removes dependency on Octokit's Release type by using the GraphQLReleaseNodetype directly throughout the application.Implementation
GitHubGraphQLTypes.cs): AddedGetReleasesResponse,ReleaseRepositoryData,ReleasesConnectionData, andReleaseNoderecords withPageInfofor paginationGitHubGraphQLClient.cs): ImplementedGetReleasesAsync(owner, repo)that returnsList<ReleaseNode>directly with automatic pagination (100 items/page) andCREATED_AT DESCorderingGitHubRepoConnector.cs): UsesReleaseNodedirectly inGitHubDataandLookupDatawithout intermediate conversions. TheGetAllReleasesAsynchelper simply returns the GraphQL results.GitHubGraphQLClientFindIssueIdsTests.cs- 8 tests for FindIssueIdsLinkedToPullRequestAsyncGitHubGraphQLClientGetCommitsTests.cs- 8 tests for GetCommitsAsyncGitHubGraphQLClientGetReleasesTests.cs- 8 tests for GetReleasesAsync (new)Benefits
Type of Change
Related Issues
Implements feature request to migrate from REST to GraphQL for releases.
Pre-Submission Checklist
Build and Test
dotnet build --configuration Releasedotnet test --configuration ReleaseCode Quality
dotnet format --verify-no-changesQuality Checks
cspell "**/*.{md,cs}"markdownlint "**/*.md"yamllint '**/*.{yml,yaml}'Testing
Documentation
Additional Notes
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.