.agents/skills/check-pr/references/gitlab-api.md
Useful GitLab REST API calls for working with merge request discussions, using glab api.
glab api automatically resolves :fullpath to the URL-encoded project path from the local git remote.
glab mr view <MR_IID> --output json
Key fields (compared to GitHub equivalents):
iid - internal MR number (use this, not id)source_branch - equivalent to GitHub's headRefNamesha - HEAD commit SHA, equivalent to GitHub's headRefOiddescription - equivalent to GitHub's bodyglab api "projects/:fullpath/merge_requests/<MR_IID>/discussions?per_page=100"
Paginate with &page=2, &page=3, etc. until the response array length is less than per_page.
Each discussion object:
id - discussion ID (used for resolution)resolved - true or falsenotes - array of note objectsEach note object:
type - "DiffNote" for inline diff comments, null for general commentsauthor.username - author's usernamebody - comment textposition.new_path - file path (for DiffNote type)glab api "projects/:fullpath/merge_requests/<MR_IID>/discussions?per_page=100" | \
jq '[.[] | select(.resolved == false and (.notes[0].type == "DiffNote"))]'
glab api --method PUT \
"projects/:fullpath/merge_requests/<MR_IID>/discussions/<DISCUSSION_ID>" \
--field resolved=true
There is no batch resolution in GitLab - issue one PUT per discussion.
glab api "projects/:fullpath/merge_requests/<MR_IID>/pipelines"
Pipeline statuses: running, pending, success, failed, canceled, skipped.
glab api "projects/:fullpath/pipelines/<PIPELINE_ID>/jobs"
Each job has name, status, stage, and web_url.
glab api "projects/:fullpath/merge_requests/<MR_IID>/notes?per_page=100"
Filter by author.username to find Greptile bot comments. The exact bot username depends on the Greptile installation - check the first Greptile comment to identify it.
glab mr note <MR_IID> --message "your message here"
Or via API:
glab api --method POST \
"projects/:fullpath/merge_requests/<MR_IID>/notes" \
--field body="your message here"