Giter Club home page Giter Club logo

create-envfile's Introduction

Create Envfile Github Action

About

A Github Action to create a .env file with Github Secrets. This is useful when you are creating artifacts that need to contain secrets stored in Github Secrets. This creates a file with variables that are defined in the Action config.

Usage

The Action looks for environment variables that start with envkey_ and creates an envfile with them. These are defined in the with section of the Action config. Here is an example of it in use:

name: Create envfile

on: [push]

jobs:

  create-envfile:
 
    runs-on: ubuntu-18.04
 
    steps:
    - name: Make envfile
      uses: creatrip/create-envfile@v2
      with:
        envkey_DEBUG: false
        envkey_SOME_API_KEY: "123456abcdef"
        envkey_SECRET_KEY: ${{ secrets.SECRET_KEY }}
        some_other_variable: foobar
        directory: <directory_name>
        file_name: .env

Inputs

In the example above, there are several key/value pairs that will be added to the envfile:

Name Description
envkey_DEBUG, envkey_SOME_API_KEY These values can be whatever, and they will be added to the envfile as DEBUG and SOME_API_KEY .
envkey_SECRET_KEY This one will use a secret stored in the repository's Github Secrets, and add it to the file as SECRET_KEY
directory (Optional) This key will set the directory in which you want to create env file. (Action will fail if the specified directory doesn't exist.)
file_name (Optional) Set the name of the output envfile. Defaults to .env

Assuming that the Github Secret that was used is password123, the .env file that is created from the config above would contain:

DEBUG: false
SOME_API_KEY: "123456abcdef"
SECRET_KEY: password123

Potential Issues

Warnings

When the Action runs, it will show Warning: Unexpected input(s) .... This is because Github is expecing all the potential input variables to be defined by the Action's definition.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.