Skip to content
settings

GitHub Action

Env Replace

v1.0.6 Latest version

Env Replace

settings

Env Replace

Change environment variables during actions

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Env Replace

uses: Langsdorf/[email protected]

Learn more about this action in Langsdorf/env-replace

Choose a version

Env Replace Action

Changes the file during build (useful for replacing environment variables in a file)

Inputs

key

The key to replace

value

The value to replace

file

The file to replace the key/value in. Default "./.env"

replace-all

List of secrets to replace.

Warning: This is useful for replacing multiple keys at once, but be careful not to replace keys that should not be replaced.

upsert

If true, will add the key/value if it does not exist. Default false

Example usage

With key and value

uses: Langsdorf/[email protected]
with:
  key: "API_URL"
  value: "https://api.example.com"

With replace-all

uses: Langsdorf/[email protected]
with:
  replace-all: |
    API_URL=https://api.example.com
    API_KEY=123456
    SECRET_VALUE=${{ secrets.SECRET_VALUE }}
  upsert: true