Skip to content

Commit

Permalink
Add documentation for using variables in the GitLab pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Taucher2003 committed Nov 18, 2023
1 parent 2dfb509 commit a5903b9
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,44 @@ jobs:
GL_API_TOKEN: ${{ secrets.GL_API_TOKEN }}
```
## Pass variables to the GitLab Pipeline
You can define variables that should be passed to the GitLab pipeline.
Every environment variable starting with `GLPA_` will be passed to the GitLab pipeline
with the `GLPA_` prefix removed.

<details>
<summary>Example with variable</summary>

With this setup, the `GITHUB_TOKEN` is available in the GitLab pipeline.
It is accessible in the GitLab pipeline with `$GITHUB_TOKEN`, because the `GLPA_`
prefix is stripped before passing it to GitLab.

```yaml
name: GitLab
on:
push:
pull_request:
jobs:
pipeline:
runs-on: ubuntu-latest
steps:
- uses: Taucher2003/GitLab-Pipeline-Action@<version>
name: Run pipeline
with:
GL_SERVER_URL: https://gitlab.com
GL_PROJECT_ID: '<project-id>'
GL_RUNNER_TOKEN: ${{ secrets.GL_RUNNER_TOKEN }}
GL_API_TOKEN: ${{ secrets.GL_API_TOKEN }}
env:
GLPA_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

</details>

## Known issues

GitHub does not pass secrets to actions triggered by pull requests from forks.
Expand Down
5 changes: 5 additions & 0 deletions release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

version = ARGV.shift

if version.nil?
puts "No version provided"
return
end

readme = File.read 'README.md'
readme_for_version = readme.gsub('Taucher2003/GitLab-Pipeline-Action@<version>',
"Taucher2003/GitLab-Pipeline-Action@#{version}")
Expand Down

0 comments on commit a5903b9

Please sign in to comment.