Back to home page

EIC code displayed by LXR

 
 

    


Warning, /trigger-gitlab-ci/README.md is written in an unsupported language. File is not indexed.

0001 # GitHub Action: eic/trigger-gitlab-ci
0002 ![test](https://github.com/eic/trigger-gitlab-ci/workflows/test/badge.svg)
0003 
0004 This GitHub Action triggers a GitLab CI pipeline through webhooks.
0005 
0006 ## Instructions
0007 
0008 ### Example
0009 
0010 You can use this GitHub Action in a workflow in your own repository with `uses: eic/trigger-gitlab-ci@v1`.
0011 
0012 A minimal job example looks as follows:
0013 ```yaml
0014 jobs:
0015   trigger-gitlab-ci:
0016     runs-on: ubuntu-latest
0017     steps:
0018     - uses: eic/trigger-gitlab-ci@v1
0019       with:
0020         project_id: 37728736
0021         token: ${{ secrets.TOKEN }}
0022 ```
0023 You will need to upload the GitLab CI pipeline trigger token to the GitHub repository or organization secrets. This token can be created in the GitLab repository settings under CI/CD > Pipeline Triggers. 
0024 
0025 ### Inputs
0026 This action requires the following inputs:
0027 - `project_id`: GitLab project ID
0028 - `token`: GitLab pipeline trigger token (GitLab Settings > CI/CD > Pipeline Triggers)
0029 
0030 This action also accepts several optional inputs:
0031 - `url`: GitLab server url (at the level under which the API starts), default: `https://gitlab.com`
0032 - `ref_name`: GitLab project ref_name (branch or tag name), default: `main`
0033 - `variables`: Additional variables in `VAR1=value VAR2=value` format to pass to the pipeline, default: ``
0034 
0035 A more advanced example could look as follows, passing variables for call backs:
0036 ```yaml
0037 jobs:
0038   trigger-gitlab-ci:
0039     runs-on: ubuntu-latest
0040     steps:
0041     - uses: eic/trigger-gitlab-ci@v1
0042       with:
0043         url: https://gitlab.cern.ch
0044         project_id: 6751
0045         token: ${{ secrets.TOKEN }}
0046         ref_name: master
0047         variables: |
0048           GITHUB_REPOSITORYURL: ${{ github.repositoryUrl }}
0049           GITHUB_SHA: ${{ github.sha }}
0050 ```
0051 
0052 ### Outputs
0053 This actions provides the following outputs:
0054 - `json`: GitLab webhook response (JSON)
0055 - `web_url`: GitLab pipeline URL
0056 
0057 These outputs can be used as follows to print the GitLab pipeline URL to :
0058 ```yaml
0059 jobs:
0060   trigger-gitlab-ci:
0061     runs-on: ubuntu-latest
0062     steps:
0063     - uses: eic/trigger-gitlab-ci@v1
0064       id: trigger
0065       with:
0066         project_id: 37728736
0067         token: ${{ secrets.TOKEN }}
0068     - uses: peter-evans/commit-comment@v2
0069       with:
0070         body: |
0071           GitLab pipeline: ${{ steps.trigger.outputs.web_url }}
0072 ```