Loading
feat(mr): add --skip-ci to mr merge
Description
Adds --skip-ci to glab mr merge. It works like the ci.skip push option: it adds [ci skip] to the commit that lands on the target branch, so that commit does not start a pipeline. It does not merge immediately, change auto-merge, skip the merge request's own pipelines, or bypass pipelines the project requires, following @phikai's comment on the issue.
- Adds
[ci skip]to the merge commit message, and also to the squash commit message with--squash. - When no
--messageis given, the MR title is used as the message, because an empty message lets GitLab write its own and the marker would be lost. This replaces the project's merge commit template, which the help text documents. - A message that already has a marker GitLab recognizes (the same case-insensitive pattern GitLab uses, for example
[skip ci]or[CI-Skip]) is left unchanged. - With
--rebase, the rebase request is sent withoutskip_ci, so the merge request pipeline still runs on the rebased code. - In a project that uses fast-forward merges, no merge commit is created, so
--skip-cireturns an error unless--squashis used. It also returns an error with--rebase, and when the project does not allow squashing. - The help text notes that the marker stays on the commit, so a tag pushed on it later also skips its pipeline.
Related Issues
Resolves #7926 (closed)
How has this been tested?
- Added cases to
TestMrMergeininternal/commands/mr/merge/mr_merge_test.go:--skip-ciadds the marker to the merge commit message and keeps auto-merge- without
--skip-ci, no commit message is sent --skip-ci --squashadds the marker to both commit messages- a message that already has the marker (
[skip ci],[CI-Skip]) is unchanged --skip-ci --rebasedoes not sendSkipCIon the rebase request, and adds the marker to the merge commit message- in a fast-forward project,
--skip-ci --squashadds the marker to the squash commit message - in a fast-forward project,
--skip-ciwithout--squash,--skip-ci --rebase, and a project that does not allow squashing each return an error - an error fetching the project is returned
Edited by Jay McCure