r-world-devs / GitStats

An R package to get unified data from GitHub and GitLab.
https://r-world-devs.github.io/GitStats/
Other
3 stars 1 forks source link

Add getting commits via GraphQL for GitLab #154

Open maciekbanas opened 1 year ago

maciekbanas commented 1 year ago

A question is it possible

maciekbanas commented 1 year ago

It seems there is no sensible way to pull all commits via GraphQL in GitLab. Only solution is pulling commits from 'mergeRequests' field.

maciekbanas commented 7 months ago

Maybe looking through merge requests isn't that bad. It could look like this:

query GetCommitsFromRepo($project_path: ID!, $merge_request: String!) {
  project(fullPath: $project_path) {
    name
    id
    webUrl
    mergeRequest(iid: $merge_request) {
      title
      commitCount
      commits(first: 100) {
        pageInfo {
          endCursor
          startCursor
        }
        nodes {
          id
          title
        }
      }
    }
  }
}
maciekbanas commented 2 weeks ago

Tried approach with merge requests. The problem is the need to iterate over multiple merge requests, which does not make it really faster than REST as there are multiple requests to API. It is probably even slower.