Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 769 Bytes

README.md

File metadata and controls

37 lines (27 loc) · 769 Bytes

secrets-replace

This action replaces values preceded by SECRET_ in a given file. This is useful for replacing github secrets in an .env file.

Inputs

file

Required The .env (or other) file where some values begin with SECRET_

Example .env file:
DB_PWD=SECRET_DB_PASSWORD
SAMPLE_KEY=SECRET_SAMPLE_KEY

secrets

Required A JSON object containing the keys (without the SECRET_ prefix) and values that should be replaced if found within the file.

Example json file:
{
  "DB_PASSWORD": "12345SecurePassword!",
  "SAMPLE_KEY": "mySecretKey123abc"
}

Example

- name: Replace secrets in .env
  uses: codeurs/secrets-replace@v4
  with:
    file: "path/to/.env"
    secrets: ${{ toJson(secrets) }}