feat(gitlab-issue-to-mr): add a label-triggered issue-to-MR automation - #533
Draft
VascoSch92 wants to merge 2 commits into
Draft
feat(gitlab-issue-to-mr): add a label-triggered issue-to-MR automation#533VascoSch92 wants to merge 2 commits into
VascoSch92 wants to merge 2 commits into
Conversation
Ports the github-issue-to-pr automation to GitLab, closing the ticket-to-code gap for the third of the big-three git providers. The script keeps every structural guarantee of the GitHub original: one poll per project with its own state document, dedup on the label event id, a claim persisted before the slow work, a clone that carries no credential, an allow-list of forwarded secrets, and a finalization pass that opens the merge request itself when the agent did not. What GitLab makes different: - resource label events with action "add" replace GitHub labeled events - issue IIDs are project-scoped, and project paths are URL-encoded wherever an ID is expected, so subgroups survive - issue labels come back as plain strings - a draft is a "Draft: " title prefix, not an API flag - git authenticates the token as the oauth2 user - the API root is configurable, so self-managed instances work, and the clone URL comes from the project rather than being built from parts - the Developer role check replaces GitHub's push permission check, reading the group role when the project states none Closes #443 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014EUZQRvv9wQ1AGrDNPAGXk
… agent Matches github-pr-reviewer: the conversation gets agent_settings.mcp_config whole, so a connected GitLab server gives the agent typed tools rather than the curl calls the prompt spells out. Those stay as the fallback, and pushing the branch is a git operation either way, so GITLAB_TOKEN is still required. An unreadable settings endpoint is a warning, not a dropped task. This widens what an issue-authored prompt can reach to everything the connected servers expose. The skill and README now say so, and the setup workflow asks the operator to confirm it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014EUZQRvv9wQ1AGrDNPAGXk
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
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.
Why
The catalog has a first-class GitHub
issue-to-prautomation, and ticket-to-codeentries for Jira, Linear, and Bitbucket, but nothing that starts from a GitLab
issue and ends in a GitLab merge request. GitLab-hosted teams could only get
there by keeping their tickets somewhere else. This ports the proven
github-issue-to-prautomation to GitLab.Note: #525 opened against the same issue on Aug 31. This branch is an independent
port written against current
main(post-#531 template rename), with a full testsuite and self-managed instance support. Whichever lands, the other should close.
Summary
skills/gitlab-issue-to-mr/—SKILL.mdsetup workflow,README.md,references/state-schema.md, andscripts/main.py, the deterministic poller.automations/catalog/gitlab-issue-to-mr/manifest.json— agitlabrepo-picker, a merge-request-mode select, a configurable API root for
self-managed instances, and a bundle pointing at the shipped script.
tests/test_gitlab_issue_to_mr.py— 70 unit tests over what the scriptowns: config validation, project-path normalization, URL encoding, access
level, credential handling, label events, branch naming, MR creation, clone
release, and state.
marketplaces/openhands-extensions.json; regenerateskills/index.js,automations/catalog-index.js,automations/bundle-index.js,and the README catalog section.
Every structural guarantee of the GitHub original is kept: one poll per project
with its own state document, dedup on the label event id, a claim persisted
before the slow work, a clone that carries no credential, an allow-list of
forwarded secrets, and a finalization pass that opens the merge request itself
when the agent did not.
One deliberate divergence from
github-issue-to-pr: the deployment's MCPservers are forwarded to the spawned conversation, as
github-pr-revieweralready does, so a connected GitLab server gives the agent typed tools instead
of curl. The curl calls stay in the prompt as the fallback, and pushing the
branch is a git operation either way, so
GITLAB_TOKENis still required. Thisdoes widen what an issue-authored prompt can reach to everything those servers
expose.
github-issue-to-prforwards nothing for exactly that reason, so thisis worth an explicit yes or no in review. Reverting it is a three-line change.
What GitLab makes different:
labeledissue eventsresource_label_eventswithaction: "add"iidowner/repoin the pathdraft: trueon the APIDraft:title prefixx-access-tokenbasic authoauth2basic authpermissions.pushapi.github.comIssue Number
Closes #443
How to Test
End to end, on a GitLab project you can push to:
GITLAB_TOKENin OpenHands Settings → Secrets, with theapiscope andat least the Developer role.
/issue-to-mr:setup.openhandslabel to an open issue.a draft merge request follows once the agent stops.
Video/Screenshots
Not applicable — no UI surface. The catalog entry renders through the existing
automation template form.
Notes
push is rejected.
https://gitlab.example.com/api/v4.automations/interface.json'sfeaturedAutomationIdsis unchanged; this entryis not featured.
beta and gated behind Duo availability on a top-level group. The API option
stores
GITLAB_TOKENand carries no MCP server. So the MCP path here is abonus when a deployment has one connected, never a requirement.
HUMAN: I ran the full test suite and the sync/build checks locally on this branch; the end-to-end GitLab run against a live project has not been done yet.
🤖 Generated with Claude Code
https://claude.ai/code/session_014EUZQRvv9wQ1AGrDNPAGXk