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 to pass to the pipeline, one `VAR=value` per line, default: ``.
0034   Values are passed literally (via `curl --form-string`), so `;`, `"`, `@` and `<` are safe. One pair of enclosing double quotes (`VAR="value"`) is stripped. Blank lines are ignored.
0035 
0036 A more advanced example could look as follows, passing variables for call backs:
0037 ```yaml
0038 jobs:
0039   trigger-gitlab-ci:
0040     runs-on: ubuntu-latest
0041     steps:
0042     - uses: eic/trigger-gitlab-ci@v1
0043       with:
0044         url: https://gitlab.cern.ch
0045         project_id: 6751
0046         token: ${{ secrets.TOKEN }}
0047         ref_name: master
0048         variables: |
0049           GITHUB_REPOSITORYURL=${{ github.repositoryUrl }}
0050           GITHUB_SHA=${{ github.sha }}
0051 ```
0052 
0053 ### Outputs
0054 This actions provides the following outputs:
0055 - `json`: GitLab webhook response (JSON)
0056 - `web_url`: GitLab pipeline URL
0057 
0058 These outputs can be used as follows to print the GitLab pipeline URL to :
0059 ```yaml
0060 jobs:
0061   trigger-gitlab-ci:
0062     runs-on: ubuntu-latest
0063     steps:
0064     - uses: eic/trigger-gitlab-ci@v1
0065       id: trigger
0066       with:
0067         project_id: 37728736
0068         token: ${{ secrets.TOKEN }}
0069     - uses: peter-evans/commit-comment@v2
0070       with:
0071         body: |
0072           GitLab pipeline: ${{ steps.trigger.outputs.web_url }}
0073 ```