| name | gitlab-integration |
| description | GitLab operations via glab CLI. Use when working with GitLab merge requests, issues, CI/CD pipelines, or repository operations. Triggers include creating/viewing/merging MRs, checking pipeline status, managing issues, and any GitLab-specific tasks. |
GitLab Integration
Patterns for interacting with GitLab via the glab CLI.
Authentication
Check Auth Status
glab auth status
Login
glab auth login
glab auth login --token <token>
Merge Requests
Create MR
glab mr create --title "Title" --description "Description"
glab mr create --title "Title" --target-branch main
glab mr create --title "Title" --label "feature,priority:high" --assignee username
glab mr create --title "Draft: Title" --draft
Create MR via Push Options
git push -o merge_request.create \
-o merge_request.target=<branch> \
-o merge_request.title="Title" \
-o merge_request.description="Description" \
-o merge_request.label="label1,label2" \
-o merge_request.assignee="username" \
-o merge_request.remove_source_branch
List MRs
glab mr list
glab mr list --state opened|merged|closed
glab mr list --target-branch=main
glab mr list --author=username
glab mr list --assignee=@me
glab mr list --label="feature"
View MR
glab mr view <id>
glab mr view <id> --comments
glab mr view <id> --web
glab mr diff <id>
Update MR
glab mr update <id> --title "New Title"
glab mr update <id> --description "New description"
glab mr update <id> --label "new-label"
glab mr update <id> --ready
MR Actions
glab mr approve <id>
glab mr merge <id>
glab mr merge <id> --squash
glab mr close <id>
glab mr reopen <id>
MR Comments
glab mr comment <id> --message "Comment text"
glab mr note <id> "Note text"
Issues
List Issues
glab issue list
glab issue list --state opened|closed
glab issue list --label "bug"
glab issue list --assignee @me
View Issue
glab issue view <id>
glab issue view <id> --comments
glab issue view <id> --web
Create Issue
glab issue create --title "Title" --description "Description"
glab issue create --title "Title" --label "bug,priority:high"
Update Issue
glab issue update <id> --title "New Title"
glab issue close <id>
glab issue reopen <id>
CI/CD
Pipeline Status
glab ci status
glab ci view
glab ci view <pipeline_id>
Job Operations
glab ci trace <job_id>
glab ci list
Pipeline Actions
glab ci retry <pipeline_id>
glab ci cancel <pipeline_id>
glab ci run
CI Config Validation
glab ci lint .gitlab-ci.yml
Repository
Clone
glab repo clone <repo>
View
glab repo view
glab repo view --web
Fork
glab repo fork <repo>
Project Configuration
View Project
glab project view
List Variables
glab variable list
API Access
Direct API Calls
glab api projects/:id/merge_requests
glab api projects/:id/issues --method POST --field title="Title"
Useful Patterns
Check MR Before Push
glab mr list --source-branch=$(git branch --show-current)
Monitor CI After Push
git push origin HEAD
sleep 5
glab ci status
Quick MR Workflow
git checkout -b feature/quick-fix
git add . && git commit -m "fix: quick fix"
git push -o merge_request.create \
-o merge_request.target=main \
-o merge_request.title="fix: quick fix"
Troubleshooting
| Issue | Solution |
|---|
| Auth failed | Run glab auth login |
| MR not found | Check MR ID and project |
| CI lint fails | Check .gitlab-ci.yml syntax |
| Push rejected | Pull and rebase first |