Skip to content

GitLab Support#5

Open
L0thlorien wants to merge 13 commits intozveinn:mainfrom
L0thlorien:main
Open

GitLab Support#5
L0thlorien wants to merge 13 commits intozveinn:mainfrom
L0thlorien:main

Conversation

@L0thlorien
Copy link

@L0thlorien L0thlorien commented Feb 12, 2026

Summary

Unifies GitHub + GitLab support behind a single CLI by adding --platform github|gitlab (default: github) and implementing both backends with a shared, canonical output renderer.
Key Changes

  • Platform switch + config isolation:
    • GitHub: ~/.github-feed/.env, ~/.github-feed/github.db
    • GitLab: ~/.gitlab-feed/.env, ~/.gitlab-feed/gitlab.db
    • Precedence: CLI flags > env vars > platform .env > defaults
  • GitHub platform implementation (platform_github.go)
    • Uses GitHub Search API with upstream-equivalent queries (Reviewed/Review Requested/Authored/Assigned/Commented/Mentioned for PRs; Authored/Mentioned/Assigned/Commented for issues)
    • Adds updated:>=YYYY-MM-DD based on --time
    • Nests issues under PRs when cross-referenced (PR/issue bodies + PR review comments)
    • Optional ALLOWED_REPOS filter (owner/repo)
    • Online mode caches to DB; --local reads from DB
  • GitLab platform extraction + canonical mapping (platform_gitlab.go)
    • Uses GitLab API with ALLOWED_REPOS required online (group[/subgroup]/repo)
    • Maps path_with_namespace to canonical display owner/repo via last-/ split (owner may include subgroups)
    • Online mode caches to DB; --local reads from DB
  • DB now supports both platforms (db.go): GitLab buckets unchanged; GitHub buckets added (pull_requests, issues, comments)
  • Tests updated/added (priority_test.go):
    • GitLab owner/repo mapping expectations
    • loadEnvFile does not override existing env vars
    • validateConfig branches by platform
  • Docs updated (README.md, CLAUDE.md) for dual-platform usage

Breaking/Behavior Notes

  • Default platform is now github. Existing GitLab users should run with --platform gitlab (or set it explicitly in usage/scripts).
  • GitLab online mode remains bounded: requires ALLOWED_REPOS.

How To Test

go test ./... -count=1
go build -o gitlab-feed .
./gitlab-feed --platform github --local --time 1m
HOME="$(mktemp -d)" env -u GITLAB_TOKEN -u GITLAB_ACTIVITY_TOKEN ALLOWED_REPOS=group/repo \
  ./gitlab-feed --platform gitlab --time 1h
# (expected: non-zero exit + "token is required for GitLab API mode")

Implementation Pointers

  • Entry/dispatch: main.go
  • GitHub backend: platform_github.go
  • GitLab backend: platform_gitlab.go
  • Cache DB: db.go
  • Tests: priority_test.go

@L0thlorien
Copy link
Author

UPD

  • .goreleaser.yml is fixed
  • Switched storage to a shared config dir: /.git-feed/.env with separate DB files (/.git-feed/github.db, ~/.git-feed/gitlab.db).
  • Added platform-specific allowed-repo vars:
    • GITHUB_ALLOWED_REPOS (GitHub)
    • GITLAB_ALLOWED_REPOS (GitLab)
    • ALLOWED_REPOS kept as legacy fallback.
  • Kept precedence as: CLI --allowed-repos > platform env var > legacy ALLOWED_REPOS.
  • Updated runtime messages/templates, tests, and docs (README.md, CLAUDE.md) to match.
  • Verified with go test ./... -count=1 and go build -o gitlab-feed . (both passing).

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