GitHub Actions to set Environment variables for gha-trigger
on:
workflow_dispatch:
inputs:
data:
required: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: gha-trigger/set-env-action@main
with:
data: ${{inputs.data}}
data
: gha-trigger's workflow_dispatch event inputdata
Nothing.
name | example | description |
---|---|---|
GHA_ACTOR | GITHUB_ACTOR | |
GHA_BASE_REF | GITHUB_BASE_REF | |
GHA_EVENT_NAME | GITHUB_EVENT_NAME | |
GHA_HEAD_REF | GITHUB_HEAD_REF | |
GHA_HEAD_SHA | ||
GHA_REF | GITHUB_REF | |
GHA_REF_NAME | GITHUB_REF_NAME | |
GHA_REPOSITORY | GITHUB_REPOSITORY | |
GHA_REPOSITORY_OWNER | GITHUB_REPOSITORY_OWNER | |
GHA_REPOSITORY_NAME | Main Repository name | |
GHA_PULL_REQUEST_NUMBER | Pull Request number | |
GHA_SHA | GITHUB_SHA | |
GHA_COMMIT_STATUS_SHA | ||
GHA_EVENT_PATH | GITHUB_EVENT_PATH | |
GHA_ENV | a file path to a shell script to override GitHub Actions default environment variables with GHA_* |
Basically, GitHub Actions default environment variables can't be changed.
When you set a custom environment variable, you cannot use any of the default environment variable names. For a complete list of these, see "Default environment variables" below. If you attempt to override the value of one of these default environment variables, the assignment is ignored.
But you can change them in run
steps.
Using GHA_ENV
in run
step, you can override GitHub Actions default environment variables.
e.g.
- run: |
echo "$GITHUB_REPOSITORY" # CI Repository
. "$GHA_ENV" # Override default environment variables GITHUB_*
echo "$GITHUB_REPOSITORY" # Main Repository
This is useful to run tools that depend on GitHub Actions default environment variables.