Skip to content

Conversation

@IanButterworth
Copy link
Member

I asked Claude to polish up #422

fyi @arnavk23

arnavk23 and others added 21 commits December 2, 2025 08:06
Classes defined inside methods/loops are inefficient as they get
redefined on each call. Moved all helper classes (IssueLike, IssueAsPR,
CommitWrapper, BranchWrapper, etc.) to module level with descriptive
names.

Also replaced generic single-letter class names (R, C, B, T, Z, O) with
descriptive names like _GitRef, _CommitWithTree, _Blob, etc. for better
debuggability.
GitLab does not have an equivalent to GitHub's repository_dispatch API.
Add a no-op method that logs a warning to prevent AttributeError when
TagBot tries to call this method on a GitLab repository.
Previously, unknown states like 'all' were passed directly to GitLab,
which only accepts 'opened' or 'closed'. Now only valid states are
mapped, and 'all' or unknown values result in no state filter (returning
all issues).
- Move logging import to module level
- Add labels attribute to _IssueAsPR and _PRFromMR for consistency
- Filter merged MRs by 'since' parameter in get_issues()
- Remove unnecessary forward reference quotes on _BranchCommit
- Add tests for private, full_name, ssh_url, html_url properties
- Add tests for get_branches, get_git_ref, get_git_tag, get_branch
- Add tests for get_commits, create_git_release (including draft error)
- Add test for create_repository_dispatch warning
- Add test for get_contents raw content fallback
- Test that labels are passed through on issues and MRs
- Fix mutable default argument in test_repo_gitlab.py
@IanButterworth IanButterworth changed the title gitlab: add GitLab support Add GitLab support Dec 3, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds GitLab support to TagBot, enabling it to work with repositories hosted on GitLab in addition to GitHub. The implementation provides a pragmatic subset of the PyGithub API by wrapping python-gitlab functionality.

Key changes:

  • New GitLab wrapper module that implements a PyGithub-compatible interface for GitLab
  • Automatic detection of GitLab hosting via URL patterns and dynamic client initialization
  • Optional python-gitlab dependency with graceful fallback and clear error messaging

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tagbot/action/gitlab.py New module implementing PyGithub-compatible wrappers around python-gitlab API for repositories, pull requests, issues, commits, releases, and file contents
tagbot/action/repo.py Modified to detect GitLab URLs and instantiate GitlabClient instead of Github; updated exception handling to support both GitHub and GitLab exception types
test/action/test_repo_gitlab.py Tests for GitLab client initialization and detection logic
test/action/test_gitlab_wrapper.py Basic tests for GitLab wrapper functionality including file contents, pull requests, and branch operations
test/action/test_gitlab_wrapper_extended.py Comprehensive tests covering releases, issues, commits, branches, git refs, and error conditions
pyproject.toml Declares python-gitlab as an optional extra dependency for GitLab support
README.md Documents GitLab support configuration with example workflow inputs and usage notes
.gitignore Adds .venv/ to ignore virtual environment directories

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Add python-gitlab as optional dependency in pyproject.toml
- Add type annotations to GitLab wrapper classes (_CommitWrapper, _CommitWithTree)
- Remove unnecessary cast() calls in repo.py
- Add comment to empty except clause
- Update poetry.lock
- Use modern poetry group syntax for dev dependencies
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 9 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Add body property to _PR class (required by repo.py line 306)
- Add closed_at to _IssueAsPR class (required by changelog.py line 131)
- Document that lazy parameter is ignored in get_repo
- Simplify README GitLab feature description
@IanButterworth
Copy link
Member Author

@arnavk23 can you review this please. I think it should be good to go.

@arnavk23
Copy link
Collaborator

arnavk23 commented Dec 3, 2025

@arnavk23 can you review this please. I think it should be good to go.

I've looked this through already. Thanks for all the help. It is good to go.

@IanButterworth IanButterworth merged commit 1ea4b6a into master Dec 3, 2025
2 checks passed
@IanButterworth IanButterworth deleted the ib/fix_422 branch December 3, 2025 17:44
@IanButterworth IanButterworth mentioned this pull request Dec 8, 2025
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.

3 participants