Repository navigation
🐛 Use authenticated GitLab GraphQL API to fetch public monthly MRs - #106
Merged
jeanphi-baconnais merged 1 commit intoNov 3, 2026
Conversation
github-actions Bot
pushed a commit
that referenced
this pull request
Nov 3, 2026
# [v1.12.2](v1.12.1...v1.12.2) (2026-11-03) ## 🐛 Bug Fixes - [`fd4865c`](fd4865c) Use authenticated GitLab GraphQL API to fetch public monthly MRs (#106) (Issues: [`#106`](#106))
|
🎉 This PR is included in version 1.12.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
Calling the GitLab REST API (
GET /api/v4/merge_requests) without anAuthorization: Bearerheader falls under GitLab'sthrottle_unauthenticated_apirate limit (500 requests / minute per IP), triggering429 Too Many Requestsduring organization-wide contribution synchronization. However, calling the REST endpoint with the Bearer token returns merge requests from private/internal projects without exposing project visibility in the REST payload.This PR switches the monthly GitLab Merge Requests lookup in
GitLabServicesto GitLab's GraphQL API (/api/graphql) authenticated with theBearertoken (2,000 requests / minute quota), queryingproject { name fullPath webUrl visibility }and strictly filtering onvisibility == "public".🚀 Main Changes
GitLabGraphQLQueries.java):qGetMergedMergeRequestsForAPeriodqueryinguser(username: $username) { authoredMergeRequests(state: merged, updatedAfter: $updatedAfter, updatedBefore: $updatedBefore, first: 100) }along withproject { name fullPath webUrl visibility }.src/main/java/fr/zenika/opensource/stats/beans/gitlab/graphql/):GitLabMergeRequestProject(withisPublic()) andGitLabMergeRequestNode.GitLabMergeRequestsCountto exposeList<GitLabMergeRequestNode> nodes.GitLabServices.java):DynamicGraphQLClientusingquarkus.smallrye-graphql-client.gitlab-api.urlandgitlab.token.getContributionsByUserIdandgetContributionsForTheCurrentYearto query GitLab GraphQL per month byusername(removing the extra/users?username=...REST call) and filter merge requests to keep only public projects (GitLabMergeRequestProject::isPublic).GitLabServicesTest.java):🧪 Verification & Testing
./mvnw -Dtest=GitLabServicesTest test(3/3 tests passing).