Skip to content

feat: Add optional group-level GitLab issue sync#2800

Closed
ktoulgaridis wants to merge 2 commits intosteveyegge:mainfrom
ktoulgaridis:polecat/obsidian/be-711@mn4o09ok
Closed

feat: Add optional group-level GitLab issue sync#2800
ktoulgaridis wants to merge 2 commits intosteveyegge:mainfrom
ktoulgaridis:polecat/obsidian/be-711@mn4o09ok

Conversation

@ktoulgaridis
Copy link
Copy Markdown
Contributor

Summary

  • Adds gitlab.group_id and gitlab.default_project_id config keys for group-level GitLab issue syncing
  • When group_id is set, FetchIssues/FetchIssuesSince use /groups/:id/issues API endpoint to aggregate issues across all projects in the group
  • Issue creation still uses the project endpoint (backward compatible)
  • Existing project-level sync is completely unchanged when group_id is not set

Config

gitlab.group_id          / GITLAB_GROUP_ID               - GitLab group ID or path
gitlab.default_project_id / GITLAB_DEFAULT_PROJECT_ID    - Project for creating new issues in group mode

Files changed

  • internal/gitlab/types.go — Added GroupID field to Client struct
  • internal/gitlab/client.goWithGroupID() builder, issuesBasePath() helper, updated fetch methods
  • internal/gitlab/tracker.go — Config loading for new keys, group-aware client initialization
  • cmd/bd/gitlab.go — CLI config struct, env var mapping, validation, status display
  • internal/gitlab/client_test.go — Tests for group endpoint routing, path encoding, builder preservation
  • cmd/bd/gitlab_test.go — Tests for config validation, env vars, client creation with group

Test plan

  • All existing tests pass (backward compatibility)
  • New tests verify group endpoint is used for FetchIssues/FetchIssuesSince
  • New tests verify CreateIssue still uses project endpoint in group mode
  • New tests verify group path URL encoding
  • New tests verify config validation accepts group_id without project_id
  • New tests verify env var mapping for new config keys

When gitlab.group_id is configured, FetchIssues and FetchIssuesSince
use the /groups/:id/issues API endpoint to aggregate issues across all
projects in the group. Issue creation still uses the project endpoint
(via gitlab.project_id or gitlab.default_project_id).

New config keys:
- gitlab.group_id / GITLAB_GROUP_ID
- gitlab.default_project_id / GITLAB_DEFAULT_PROJECT_ID

Backward compatible: existing project-level sync is unchanged when
group_id is not set.
Add optional filters for labels, project, milestone, and assignee to
the GitLab issue sync. Filters work on both project and group endpoints.

Filters can be set via config (gitlab.filter_labels, etc.), environment
variables (GITLAB_FILTER_LABELS, etc.), or CLI flags (--label, --project,
--milestone, --assignee). CLI flags override config defaults.

Labels, milestone, and assignee are passed as GitLab API query params.
Project filtering within a group is done client-side since the GitLab
group issues API doesn't support it natively.
@ktoulgaridis
Copy link
Copy Markdown
Contributor Author

Closing duplicate — polecat auto-pushed this branch. Keeping #2801 (feat/gitlab-group-sync) as the canonical PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant