Automate your tasks with MR template using Gitlab Commands

Lee young-jun
3 min readJan 22, 2025

--

I’m using MR Template to put essential informations

## 🛠 작업 목적
- 왜 이 기능을 구현했는지 설명해주세요.

## 🔎 작업 내용
- 기능을 구현하기 위해 어떤 작업/수정을 했는지 설명해주세요

## 이미지 첨부
- 로그나 UI인 경우 스크린샷

Repeating Tasks

However I had to do more same work whenever creating it.

Addittional tasks are these.

  1. Assign me as an assignee
  2. Add colleagues as reviewers
  3. Add iOS, … into labels

So I looked for the way to automate them.

We can use commands inside MR markdown. Just press Splash(/) you can see the commands.

They will do something and be disappeared after creatig/saving.

Commands

Assigning me

I could find assign , but I wanted to target me without my ID.
In Gitlab markdown we can specify someone with @{ID}.
Therefore I tried assign me like this.

/assign @me

However it doesn’t work. For this case I should remove @ symbol

I removed assignee

and saved with this command and I saw this result 😎

Adding reviewers

This job is more complex than assignment. I had to add few colleagues for each MR. Actually I can’t use group for the behavior.

So I guessed this can be automated by adding all colleagues including me always.

I typed /review to search any command for managing reviewers

It’s assign_reviewer and a little longer than assign. I could use reviewer instead.

The command only accepts accounts, not name. However we can search them by name like this and just click it.

/reviewer @{id}

We can also put multiple users at reviewers like this

/assign_reviewer @ABCD @EFG @HIJK @LMN @OPQR

Adding labels

Last one we can automate is label.
My role is an iOS developer, so my tasks are my tasks are only for iOS.

Therefore my MR always has iOS.

How to set label iOS?

it’s very simple just

/labels ~iOS

If type ~, we can see tags also.

Now I don’t have to add iOS tag at least whenever creating MR.

Conclusion

I don’t have any permission to control the Gitlab project here.
So I look for the way to reduce boilerplate jobs.

Using several commands in the MR template, I can reduce repetitive tasks I had to do. I hope this article help you save your time.

Happy Coding!

If you found this post helpful, please give it a round of applause 👏. Explore more Git-related content in my other posts.

For additional insights and updates, check out my LinkedInprofile. Thank you for your support!

--

--

No responses yet