GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - raven-actions/environment-variables: 🔠 Fetch and use deployment environment variables without hitting deployment.

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
BranchesTags
Open more actions menu

Latest commit

 

History

40 Commits
40 Commits

Folders and files

NameName
Last commit message
Last commit date
.devcontainer
.devcontainer
 
 
.github
.github
 
 
.taskfiles
.taskfiles
 
 
.vscode
.vscode
 
 
src
src
 
 
tests
tests
 
 
.editorconfig
.editorconfig
 
 
.eslintignore
.eslintignore
 
 
.eslintrc.yml
.eslintrc.yml
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.lycheeignore
.lycheeignore
 
 
.mega-linter.yml
.mega-linter.yml
 
 
.node-version
.node-version
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
.prettierignore
.prettierignore
 
 
.prettierrc.yml
.prettierrc.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
Taskfile.yml
Taskfile.yml
 
 
action.yml
action.yml
 
 
codecov.yml
codecov.yml
 
 
jest.config.js
jest.config.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

🔠 Environment Variables Action

GitHub - marketplace GitHub - release GitHub - ci Codecov GitHub - license


⚠️ The name of the action may be confusing, and it is not related to the ordinary meaning of the environment variables, as we know on the OS level (after all, it can set environment variables anyway), but to variables on the GitHub Deployment Environments.

One way to handle deployments is to use Deployment Environments. However, there may be cases where Deployment Environment variables need to be used before the deployment process.

With this GitHub Action, you can access Deployment Environment variables from GitHub workflow not associated with any deployment. For example, this allows you to delay approval until after the planning stage but before applying it or any other situations where you must utilize Deployment Environment variables without proceeding with Environment deployment.

The action will fetch all variables from the Deployment Environment and set them in the workflow as action output and/or as environment variables on the OS level.

📑 Table of Contents

  • 🛠️ Usage
    • Prerequisites (permissions)
    • Quick Start
  • 📥 Inputs
  • 📤 Outputs
  • 👥 Contributing
  • 🛡️ License

🛠️ Usage

Prerequisites (permissions)

You cannot use the built-in GitHub Token (well-known as ${{ github.token }} or ${{ secrets.GITHUB_TOKEN }}) with this action because it does not support Deployment Environments read access.

You have to create a fine-grained Personal Access Token on the Developer Settings page, or for more scalable organization-wide scenarios, you can consider GitHub Apps. It has a higher rate limit than PATs but requires additional configuration steps on your GitHub workflow. Please follow the GitHub App Setup example.

No matter which way you choose the required scope for this GitHub Action is environments:read.

Quick Start

The minimum required inputs are github-token with your GitHub Token and environment with the deployment environment name that you want to use to fetch variables.

The below example assumes the Deployment Environment name is staging and contains two variables:

  • MY_VAR1 with value Lorem ipsum
  • FOOBAR with value Abc123
- name: Staging Environment Variables
  id: staging-env-vars
  uses: raven-actions/environment-variables@v2
  with:
    github-token: ${{ secrets.MY_GH_TOKEN }}
    environment: staging

In the subsequence step, you can use variables in two ways.

  1. as action outputs, where the output name is the variable key.

    - run: |
        echo "${{ steps.staging-env-vars.outputs.MY_VAR1 }}"
        echo "${{ steps.staging-env-vars.outputs.FOOBAR }}"
  2. as environment variables, where the env name is the variable key.

    - run: |
        echo "${{ env.MY_VAR1 }}"
        echo "${FOOBAR}"

Whatever method you choose the output will be:

Lorem ipsum
Abc123

💡 In some scenarios, you may use variables from multiple Deployment Environments in the same Job where the variable key is the same. To avoid override, you can prefix environment variables with the env-prefix input. See the 📥 Inputs section for more details.

📥 Inputs

Name Type Required Default Description
github-token string true not set GitHub token to use for API authentication with environment:read. scope.
environment string true not set Deployment Environment name.
output-to string false all Output type. One of:
- action returns variables as action output
- env returns variables as environment variables
- all action output + envvars.
env-prefix string false not set Prefix for environment variables. Environment variables prefix will be upper-cased and striped from any special characters. A double underscore __ is placed between environment prefix and env name (MYPREFIX__VAR).
repository string false github.repository To fetch variables from Deployment Environment placed in different repository, set full repository name in the owner/repo format.
dry-run boolean false false Whether or not to actually perform operation. Set to true for testing. Will not set outputs/envvars - just log entries.

📤 Outputs

  • The action does not have any static action outputs. Only dynamic action output based on your variables from Deployment Environment, if output-to is all or action.
  • The action does not have any static environment variables outputs. Only dynamic environment variables output based on your variables from Deployment Environment, if output-to is all or env.

👥 Contributing

Contributions to the project are welcome! Please follow Contributing Guide.

🛡️ License

This project is distributed under the terms of the MIT license.

About

🔠 Fetch and use deployment environment variables without hitting deployment.

github.com/marketplace/actions/environment-variables

Topics

github-actionsraven-actions

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

5 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.