Skip to content

chore: migrate to graphql API when possible#96

Merged
Namchee merged 11 commits intomasterfrom
chore/graphql-api
Oct 29, 2023
Merged

chore: migrate to graphql API when possible#96
Namchee merged 11 commits intomasterfrom
chore/graphql-api

Conversation

@Namchee
Copy link
Owner

@Namchee Namchee commented Oct 29, 2023

Overview

Closes #94

This pull request migrates most of GitHub API endpoint from REST API v3 to GraphQL API v4. Benefits from this migration are:

  • Removes issue linking caveats, since GraphQL endpoint provides the necessary data without a workaround.
  • Future-proofing since GitHub keeps pushing for GraphQL API v4.
  • (Negligible) Fetch less data as we only requested the properties we need with GraphQL.

Moreover, this pull request introduces the following changes:

  • Meta is now included in the Repository object, reducing the amount of parameters passed on validators and whitelist
  • Pass all context objects

Caveats

  • Mutations are not migrated to GraphQL API yet, since it communicates with GraphQL ID, which potentially breaks existing API.
  • GetComments is not migrated to GraphQL API yet, since the cursor implementation does not accept an empty string that will be used as a starting point when fetching data.

@codecov
Copy link

codecov bot commented Oct 29, 2023

Codecov Report

Merging #96 (117593e) into master (cc86d48) will increase coverage by 0.54%.
The diff coverage is 98.13%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #96      +/-   ##
==========================================
+ Coverage   98.83%   99.37%   +0.54%     
==========================================
  Files          22       21       -1     
  Lines         684      632      -52     
==========================================
- Hits          676      628      -48     
+ Misses          7        3       -4     
  Partials        1        1              
Files Coverage Δ
internal/entity/config.go 100.00% <100.00%> (ø)
internal/service/github.go 97.80% <100.00%> (-0.24%) ⬇️
internal/validator/body.go 100.00% <100.00%> (ø)
internal/validator/branch.go 100.00% <100.00%> (ø)
internal/validator/commit.go 100.00% <100.00%> (ø)
internal/validator/file.go 100.00% <100.00%> (ø)
internal/validator/issue.go 100.00% <100.00%> (ø)
internal/validator/title.go 100.00% <100.00%> (ø)
internal/whitelist/bot.go 100.00% <100.00%> (ø)
internal/whitelist/draft.go 100.00% <100.00%> (ø)
... and 4 more

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cc86d48...117593e. Read the comment docs.

@Namchee Namchee merged commit 0ebb5f7 into master Oct 29, 2023
@Namchee Namchee deleted the chore/graphql-api branch October 29, 2023 08:25
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.

chore: migrate to GraphQL API

1 participant