GitLab Tag Push Trigger
GitLab tag push events occur when tags are created or updated in a GitLab repository. This is useful for running tasks when releases are created.
Placing the following snippet at the top of an RWX file will result in all tasks in the file running on every GitLab tag push.
on:
gitlab:
tag-push:
It's common to pass values from the event as init parameters into tasks.
on:
gitlab:
tag-push:
init:
tag-name: ${{ event.git.ref }}
commit-sha: ${{ event.git.sha }}
base:
os: ubuntu 24.04
tag: 1.2
tasks:
- key: release
call: git/clone 1.6.9
with:
repository: [email protected]:YOUR_ORG/YOUR_REPO.git
ref: ${{ init.commit-sha }}
ssh-key: ${{ gitlab['YOUR_ORG/YOUR_REPO'].ssh-key }}
Event Fields
The following values are available in the event
context for GitLab tag push triggers:
Path | Description |
---|---|
event.git.sha | The SHA of the commit that triggered the event. |
event.git.ref | The ref that was pushed (e.g., refs/tags/v1.0.0 ). |
event.gitlab.tag-push.after | The SHA of the commit after the tag push. |
event.gitlab.tag-push.project.id | The ID of the GitLab project. |
event.gitlab.tag-push.project.path_with_namespace | The full path of the project (e.g., group/subgroup/project ). |
event.gitlab.tag-push.project.web_url | The web URL of the project. |
event.gitlab.tag-push.user_id | The ID of the user who pushed the tag. |
event.gitlab.tag-push.user_username | The username of the user who pushed the tag. |
For all values available in the event.gitlab
context for GitLab tag push triggers, see GitLab's documentation on tag push events.