-
-
Notifications
You must be signed in to change notification settings - Fork 325
Add GitLab support via glab CLI #736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hjanuschka
wants to merge
11
commits into
dlvhdr:main
Choose a base branch
from
hjanuschka:gitlab
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Features: - Add --gitlab <hostname> flag to enable GitLab mode - Add provider abstraction layer (provider package) - GitLab provider uses glab CLI for API calls - Support MR (Merge Request) terminology in GitLab mode - Support GitLab-specific query syntax (repo:, author:, assignee:, reviewer:, label:) - Tasks (merge, close, reopen, etc.) use glab mr commands in GitLab mode Usage: ./gh-dash --gitlab gitlab.example.com --config ./gitlab-config.yml Configuration: In GitLab mode, use 'repo:GROUP/PROJECT' in filters to specify the project. Prerequisites: - glab must be installed and configured with: glab auth login --hostname <your-gitlab-host>
- Fetch and cache label colors from GitLab API for each project - Use cached colors when displaying labels in MRs and Issues - Fall back to default gray color (6e7681) when no color is available - Handle both GitHub (no #) and GitLab (with #) color formats
- Fetch MR commits via GitLab API (projects/:id/merge_requests/:iid/commits) - Fetch MR changed files via GitLab API (projects/:id/merge_requests/:iid/changes) - Parse diff to count additions/deletions per file - Show file change count in MR overview (from changes_count field) - Commits tab now shows commit history with author and date - Files Changed tab now shows list of modified files with +/- stats
Updated all commands to use glab instead of gh when in GitLab mode: PR/MR operations: - diff: glab mr diff - checkout: glab mr checkout - comment: glab mr note - approve: glab mr approve - assign/unassign: glab mr update --assignee/--unassign - watch checks: glab ci status --live Issue operations: - close: glab issue close - reopen: glab issue reopen - comment: glab issue note - assign/unassign: glab issue update --assignee/--unassign - label: glab issue update --label/--unlabel
- Add Files field to EnrichedPullRequestData for GitLab - Convert provider ChangedFiles to data ChangedFiles - Update Files Changed tab to use enriched data when available - Update overview to show correct files/commits count from enriched data - Add GLAB_PAGER env var for glab mr diff command
- Use GitLab API endpoint (projects/:id/merge_requests/:iid/notes) instead of non-existent 'glab mr note list' command - Filter out system-generated notes (commits, description changes, etc.) - Update comment count to reflect actual user comments
Issue comments: - Add FetchIssueComments to Provider interface - Implement GitLab API call (projects/:id/issues/:iid/notes) - Filter out system-generated notes - Add enrichment mechanism to fetch comments when viewing an issue - Handle IssueCommentsMsg in UI to update sidebar Pagination: - Add --page flag support to FetchPullRequests and FetchIssues - Use EndCursor as page number (stored as string) - Return next page number in EndCursor for subsequent fetches
The syncSidebar() function returns a tea.Cmd that fetches issue comments for GitLab, but this command was not being executed in several places: - onViewedRowChanged: was overwriting cmd with PR enrich only - TogglePreview: was not using the returned cmd at all - Text input handlers: were not batching the sync cmd Fixed by: - Using tea.Batch to combine syncSidebar cmd with other cmds - Simplified EnrichIssueComments condition (always fetch if no nodes)
The bug was that after SetIssueComments updated the issue with fetched comments, syncSidebar() was called which re-fetched the row data from the section (without comments) and overwrote the updated data. Fix: Just update the sidebar content directly instead of calling syncSidebar() after setting comments. Also added debug logging to FetchIssueComments for troubleshooting.
- Add getRepoFlag() helper to return '--repo' for GitLab, '-R' for GitHub - Fix PRReady to use 'glab mr update --ready' for GitLab - Fix UpdatePR to use 'glab mr rebase' for GitLab (instead of update-branch) - Fix MergePR and CreatePR to use correct repo flag - Update task messages to use MR label for GitLab - Remove debug logging from FetchIssueComments
- Fetch pipeline jobs from GitLab API when enriching MR data - Display pipeline jobs in the Checks tab with status icons - Support both 'pipeline' and 'head_pipeline' fields from GitLab API - Add PipelineJob struct to provider and data layers - Calculate check stats from GitLab jobs for overview display
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for GitLab instances, allowing users to use gh-dash with their GitLab servers via the
glabCLI.Features
--gitlab <hostname>flag: Enables GitLab mode and specifies which GitLab instance to connect tointernal/providerpackage that abstracts the differences between GitHub and GitLab APIsglabCLI for all API interactionsrepo:,author:,assignee:,reviewer:,label:filtersglab mrcommands in GitLab modeUsage
Configuration Example
Prerequisites
glabCLI must be installed (installation guide)glabmust be authenticated with the target GitLab instanceTechnical Details
Screenshots
Works the same as GitHub mode, but connects to GitLab instances