Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

gatsby-source-gitlab

Gatsby.js source plugin for loading information from GitLab

Learn more about Gatsby and its plugins here: https://www.gatsbyjs.org/docs/plugins/

See it live on the example site! Source Code for the example site.

Install

npm install gatsby-source-gitlab
# OR
yarn add gatsby-source-gitlab

How to use

// gatsby-config.js
plugins: [
  {
    resolve: `gatsby-source-gitlab`,
    options: {
      // You can get your access token on your GitLab profile
      accessToken: 'your access token here',
    }
  },
]

GraphQL Queries

To see all possible queries please use the GraphiQL editor which is available under http://localhost:8000/___graphql

Get all projects of the user:

query {
  allGitlabProjects {
    edges {
      node {
        id
        name
        description
        created_at
        visibility
        default_branch
        web_url
        readme_url
        owner {
          id
          name
        }
        forks_count
        star_count
        archived
        import_status
        name_with_namespace
        path_with_namespace
        path
        last_activity_at
        creator_id
        namespace {
          id
          name
          path
          kind
          full_path
        }
        _links {
          self
          issues
          merge_requests
          repo_branches
          labels
          events
          members
        }
      }
    }
  }
}

Get all user information:

query {
  gitlabUser {
    id
    name
    email
    username
    bio
    state
    avatar
    location
    website
    profile_url
    organization
    socialMedia {
      skype
      twitter
      linkedin
    }
  }
}

License

MIT © Byurhan Beyzat.
Buy me a coffee

© 2023 Gatsby, Inc.