Skip to content

Commit

Permalink
Merge pull request #15 from Taucher2003/document-variable-support
Browse files Browse the repository at this point in the history
Add documentation for using variables in the GitLab pipeline
  • Loading branch information
Taucher2003 authored Nov 18, 2023
2 parents 2dfb509 + b3fae10 commit 7f816c6
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 7f816c6

Please sign in to comment.