Skip to content

feat(check-pr-format): ✨ GitLab API support for the gh-based actions - #152

Draft
tomgrv wants to merge 7 commits into
developfrom
ccr-df368c1e-gn1q4f
Draft

tomgrv wants to merge 7 commits into
developfrom
ccr-df368c1e-gn1q4f

Conversation

@tomgrv

@tomgrv tomgrv commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

Inside GitLab CI (GITLAB_CI=true), these actions use the GitLab REST API (curl + jq, PRIVATE-TOKEN: $GITLAB_TOKEN) instead of gh. The GitHub path is unchanged. One commit per action:

  • check-pr-format: read and fix the merge request title.
  • create-pr: find, create or update the merge request and push with the access token.
  • clean-branches: delete the branches of merged and closed merge requests (up to 500 per state).
  • update-labels: list, create, update and delete the project labels (colors get their #).
  • release-promote: push the release with the token and comment the released merge requests and the issues they close.
  • degit-package, split-package: clone from $CI_SERVER_URL with the token (degit-package reads the default branch through the API).
  • config-bot needs no change: set BOT_NAME / BOT_EMAIL.

FORGE=github (create-pr, degit-package, split-package) targets GitHub repositories from a GitLab job. GITLAB_TOKEN is a project access token (api scope, plus write_repository / read_repository where the action clones or pushes); the CI job token cannot edit merge requests. Each action has a README section and mocked-curl bats tests. prefix-orphan-branches is covered by tomgrv/scripts#107 (git-fix-orphans).

Bug fixed on the way

degit-package/run.sh had if ! mkdir -p "$T" && rsync ...: once mkdir succeeds, ! mkdir is false and rsync never runs, so the import copied nothing. It is now if ! { mkdir -p ... && rsync ...; }. This also affects the GitHub path.

Used by tomgrv/devcontainer-features#245.

Tests

  • New bats tests pass (check-pr-format 3, create-pr 4, clean-branches 8, update-labels 3, release-promote 10, degit-package 2).
  • In this sandbox the older release-promote tests need zz-log on PATH, and two config-bot tests need network; both fail identically on the unchanged branch.

Not verified

  • Not run against a real GitLab project; the API calls are covered by mocked curl only. split-package's GitLab clone has no test (it needs the splitsh-lite binary), and release-promote relies on setup-gitversion / setup-gitflow running under zz-use -x, which was not exercised end to end.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XWCx6ifQFkyqUFNvkGPo4o

…ab API

When GITLAB_CI=true, read and fix the title with curl and a project
access token instead of the gh CLI.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XWCx6ifQFkyqUFNvkGPo4o
tomgrv pushed a commit to tomgrv/devcontainer-features that referenced this pull request Oct 29, 2026
…ab merge requests

check-pr-format now reads and fixes the title through the GitLab API
(tomgrv/actions#152), so the job is no longer pending.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XWCx6ifQFkyqUFNvkGPo4o
Inside GitLab CI (or with FORGE=gitlab), find, create or update the merge
request with curl and push with a project access token; FORGE=github keeps
targeting GitHub repositories from a GitLab job.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XWCx6ifQFkyqUFNvkGPo4o
…ab API

Inside GitLab CI, list merged, closed and open merge requests and delete
the stale branches with curl instead of gh.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XWCx6ifQFkyqUFNvkGPo4o
Inside GitLab CI, list, create, update and delete the project labels with
curl instead of gh.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XWCx6ifQFkyqUFNvkGPo4o
@tomgrv tomgrv changed the title feat(check-pr-format): ✨ update merge request titles through the GitLab API feat(check-pr-format): ✨ GitLab API support for check-pr-format, create-pr, clean-branches, update-labels Oct 29, 2026
…through the GitLab API

Inside GitLab CI, push with GITLAB_TOKEN and comment the released merge
requests and the issues they close with curl instead of gh.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XWCx6ifQFkyqUFNvkGPo4o
@tomgrv tomgrv changed the title feat(check-pr-format): ✨ GitLab API support for check-pr-format, create-pr, clean-branches, update-labels feat(check-pr-format): ✨ GitLab API support for the gh-based actions Oct 29, 2026
The GitLab API returns at most 100 merge requests per page: read up to five
pages per state, in line with the 500 limit of the gh path.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XWCx6ifQFkyqUFNvkGPo4o
…r running

Inside GitLab CI, read the default branch through the API and clone with
GITLAB_TOKEN (FORGE=github keeps GitHub sources). split-package gets the same
forge switch for its clone. Also fixes `! mkdir -p && rsync`, which skipped
rsync whenever the target directory could be created.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XWCx6ifQFkyqUFNvkGPo4o
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.

2 participants