🚀 GitHub Action for Environment Variables
Find a file
2020-11-28 08:08:32 +01:00
.github/workflows Merge branch 'primary' into feat/improve-demo-add-env-vars 2020-11-27 21:18:32 +01:00
dist Update dist script. 2020-11-28 07:55:14 +01:00
images Add social preview image. 2020-07-15 17:41:33 +02:00
.editorconfig Add tests and CI. 2020-07-14 12:06:58 +02:00
.eslintrc.json Add tests and CI. 2020-07-14 12:06:58 +02:00
.gitignore Initial commit. 2020-02-10 22:41:27 +01:00
action.yml Switch to JavaScript action. 2020-07-13 12:12:00 +02:00
index.js Add more environment variables. 2020-11-26 20:44:14 +01:00
index.test.js Add slug values. 2020-07-16 11:13:18 +02:00
LICENSE Initial commit. 2020-02-10 22:41:27 +01:00
Makefile Add tests and CI. 2020-07-14 12:06:58 +02:00
package-lock.json Add required build dev dependency. 2020-11-28 07:55:01 +01:00
package.json Add required build dev dependency. 2020-11-28 07:55:01 +01:00
README.md Add more environment variables. 2020-11-26 20:44:14 +01:00

:octocat: 🚀 GitHub Environment Variables Action

GitHub Action: View on Marketplace Demo: available Version: v1.3.0 Lint and Test license: MIT

A GitHub Action to expose useful environment variables.

Environment Variables exposed by this Action

Environment Variable Name Description Example value
GITHUB_REPOSITORY_SLUG The slug of the owner and repository name (i.e. slug of FranzDiebold/github-env-vars-action). franzdiebold-github-env-vars-action
GITHUB_REPOSITORY_OWNER The owner of the repository. FranzDiebold
GITHUB_REPOSITORY_OWNER_SLUG The slug of the owner of the repository. franzdiebold
GITHUB_REPOSITORY_NAME The name of the repository. github-env-vars-action
GITHUB_REPOSITORY_NAME_SLUG The slug of the name of the repository. github-env-vars-action
GITHUB_REF_SLUG The slug of the branch or tag ref that triggered the workflow (i.e. slug of refs/heads/feat/feature-branch-1).
If neither a branch or tag is available for the event type, the variable will not exist.
refs-heads-feat-feature-branch-1
GITHUB_BRANCH_NAME The branch name that triggered the workflow. For pull requests it is the head branch name. feat/feature-branch-1
GITHUB_BRANCH_NAME_SLUG The slug of the branch name that triggered the workflow. For pull requests it is the slug of the head branch name. feat-feature-branch-1
GITHUB_REF_NAME The branch or tag name that triggered the workflow.
If neither a branch or tag is available for the event type, the variable will not exist.
feat/feature-branch-1
GITHUB_REF_NAME_SLUG The slug of the branch or tag name that triggered the workflow.
If neither a branch or tag is available for the event type, the variable will not exist.
feat-feature-branch-1
GITHUB_HEAD_REF_SLUG The slug of the head branch name.
Only set for event type pull request or forked repositories.
feat-feature-branch-1
GITHUB_BASE_REF_SLUG The slug of the base branch name.
Only set for event type pull request or forked repositories.
main
GITHUB_SHA_SHORT The shortened commit SHA (8 characters) that triggered the workflow. ffac537e

The slugified values are designed to be used in a URL.

Default Environment Variables exposed by GitHub

For a full list of default environment variables exposed by GitHub see https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables.

Environment Variable Name Description Example value
GITHUB_ACTOR The name of the person or app that initiated the workflow. octocat
GITHUB_REPOSITORY The owner and repository name. FranzDiebold/github-env-vars-action
GITHUB_SHA The commit SHA that triggered the workflow. ffac537e6cbbf934b08745a378932722df287a53
GITHUB_REF The branch or tag ref that triggered the workflow.
If neither a branch or tag is available for the event type, the variable will not exist.
refs/heads/feat/feature-branch-1
GITHUB_HEAD_REF Only set for forked repositories / pull request. The branch of the head repository / the head branch name. feat/feature-branch-1
GITHUB_BASE_REF Only set for forked repositories / pull request. The branch of the base repository / the base branch name. main

🚀 Example usage

steps:
  - uses: FranzDiebold/github-env-vars-action@v1.3.0
  - name: Print environment variables
    run: |
      echo "GITHUB_REPOSITORY_SLUG=$GITHUB_REPOSITORY_SLUG"
      echo "GITHUB_REPOSITORY_OWNER=$GITHUB_REPOSITORY_OWNER"
      echo "GITHUB_REPOSITORY_OWNER_SLUG=$GITHUB_REPOSITORY_OWNER_SLUG"
      echo "GITHUB_REPOSITORY_NAME=$GITHUB_REPOSITORY_NAME"
      echo "GITHUB_REPOSITORY_NAME_SLUG=$GITHUB_REPOSITORY_NAME_SLUG"
      echo "GITHUB_REF_SLUG=$GITHUB_REF_SLUG"
      echo "GITHUB_BRANCH_NAME=$GITHUB_BRANCH_NAME"
      echo "GITHUB_BRANCH_NAME_SLUG=$GITHUB_BRANCH_NAME_SLUG"
      echo "GITHUB_REF_NAME=$GITHUB_REF_NAME"
      echo "GITHUB_REF_NAME_SLUG=$GITHUB_REF_NAME_SLUG"
      echo "GITHUB_HEAD_REF_SLUG=$GITHUB_HEAD_REF_SLUG"
      echo "GITHUB_BASE_REF_SLUG=$GITHUB_BASE_REF_SLUG"
      echo "GITHUB_SHA_SHORT=$GITHUB_SHA_SHORT"      

Demo

A demo for all Operating systems (Linux, macOS and Windows) is also available in the demo workflows file of this repository!