Skip to content

Implement mutation to add a commit to branch in GraphQL

Problem to solve

GitLab has a REST API to commit changes to the branch, but the functionality is not currently available in GraphQL

Further details

Users can POST /projects/:id/repository/commits to add a new commit to a branch.

Required attributes:

| Attribute      | Type           | Required | Description                                                                                                                             |
|----------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------|
| id             | integer/string | yes      | The ID or URL-encoded path of the project                                                                                               |
| branch         | string         | yes      | Name of the branch to commit into. To create a new branch, also provide either start_branch or start_sha, and optionally start_project. |
| commit_message | string         | yes      | Commit message                                                                                                                             
| actions[]      | array          | yes      | An array of action hashes to commit as a batch. See the next table for what attributes it can take.                                     |

Proposal

Add a GraphQL endpoint

Documentation

GraphQL is mostly self-documenting.

Edited by Vasilii Iakliushin