Skip to content

Create and destroy your .env file on GitHub Actions

Notifications You must be signed in to change notification settings

tmshkr/handle-env

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

handle-env

Simple utility to handle creating and deleting the .env file for a GitHub Actions workflow.

The .env file will be available to subsequent steps in the workflow, and then (optionally) deleted at the end of the job with shred.

Helps with remote development, for example, using VS Code and ngrok-ssh.

Usage

name: handle-env
on:
  workflow_dispatch:

jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: tmshkr/[email protected]
        with:
          env: |
            FOO_VAR=42
            BAR_VAR=43
            BAZ_VAR=44
            SECRET_VAR=${{ secrets.SECRET_VAR }}
      - name: Print .env file
        run: cat .env

The .wait file

Before the action deletes the .env file, it will look for a .wait file in the $GITHUB_WORKSPACE directory.

If the .wait file exists, the action will wait for that file to be deleted before deleting the .env file.

This can be useful when debugging a workflow, so that you can use or inspect the .env file before it is deleted.

About

Create and destroy your .env file on GitHub Actions

Resources

Stars

Watchers

Forks

Packages

No packages published