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 jsonKey fields (compared to GitHub equivalents):
iid— internal MR number (use this, notid)source_branch— equivalent to GitHub'sheadRefNamesha— HEAD commit SHA, equivalent to GitHub'sheadRefOiddescription— equivalent to GitHub'sbody
glab 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—trueorfalsenotes— array of note objects
Each note object:
type—"DiffNote"for inline diff comments,nullfor general commentsauthor.username— author's usernamebody— comment textposition.new_path— file path (forDiffNotetype)
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=trueThere 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"