Skip to content

appleboy/gitlab-ci-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 GitLab CI for GitHub Actions

trigger gitlab job

GitHub Action for trigger gitlab-ci jobs. See Trigger pipelines by using the API.

Usage

Trigger New GitLab CI Job.

name: trigger gitlab job
on: [push]
jobs:

  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
    - name: trigger Job
      uses: appleboy/gitlab-ci-action@v1.1.0
      with:
        host: "http://example.com"
        token: ${{ secrets.TOKEN }}
        project_id: 100

GitLab Setting

See the detail documentation for Triggering pipelines through the API. How to get the token from a new trigger? You can add a new trigger by going to your project’s Settings ➔ CI/CD under Pipeline trigger tokens.

token

How to get the project ID? going to your project’s Settings ➔ General under General project.

projectID

Example

Specific the GitLab host URL:

- name: trigger Job
  uses: appleboy/gitlab-ci-action@v1.1.0
  with:
    host: "http://example.com"
    token: ${{ secrets.TOKEN }}
    debug: true
    project_id: 100

Other specific branch or tag name:

- name: trigger Job
  uses: appleboy/gitlab-ci-action@v1.1.0
  with:
    host: "http://example.com"
    token: ${{ secrets.TOKEN }}
    debug: true
    project_id: 100
    ref: v1.0.0

Pass the variables to the triggered pipeline:

- name: trigger Job
  uses: appleboy/gitlab-ci-action@1.1.0
  with:
    host: "http://example.com"
    token: ${{ secrets.TOKEN }}
    debug: true
    project_id: 100
    variables: key1=value01,key2=value02

Input variables

  • host - Optional. gitlab-ci base url, default as https://gitlab.com
  • token - Required. A unique trigger token can be obtained when adding a new trigger.
  • project_id - Required. project id.
  • ref - Optional. Triggers can be used to force a pipeline rerun of a specific ref (branch or tag) with an API call. Default as main.
  • insecure - Optional. Allow insecure SSL connections. Default as false.
  • variables - Optional. Variables to be passed to the triggered pipeline. Default as empty. example: key1=value01,key2=value02.
  • debug - Optional. show the debug message.
  • wait - Optional. wait for pipeline to complete
  • timeout - Optional. timeout waiting for pipeline to complete
  • interval - Optional. interval waiting for pipeline to complete