GitLab Push Trigger

Placing the following snippet at the top of an RWX file will result in all tasks in the file running on every GitLab push.

on:
  gitlab:
    push:

It's common to pass values from the event as init parameters into tasks.

on:
  gitlab:
    push:
      init:
        commit-sha: ${{ event.git.sha }}

base:
  os: ubuntu 24.04
  tag: 1.2

tasks:
  - key: code
    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 push triggers:

PathDescription
event.git.shaThe SHA of the commit that triggered the event.
event.git.refThe ref that was pushed (e.g., refs/heads/main).
event.gitlab.push.afterThe SHA of the commit after the push.
event.gitlab.push.project.idThe ID of the GitLab project.
event.gitlab.push.project.path_with_namespaceThe full path of the project (e.g., group/subgroup/project).
event.gitlab.push.project.web_urlThe web URL of the project.
event.gitlab.push.user_idThe ID of the user who pushed.
event.gitlab.push.user_usernameThe username of the user who pushed.

For all values available in the event.gitlab context for GitLab push triggers, see GitLab's documentation on push events.