You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Github Action to create a .env file with Github Secrets. This is useful when
14
+
you are creating artifacts that need to contain secrets stored in Github
15
+
Secrets. This creates a file with variables that are defined in the Action
16
+
config.
6
17
7
18
## Usage
8
19
9
-
The action looks for environment variables that start with `INPUT_ENVKEY_` and creates an envfile with them. To add a key to the envfile, add a key/pair to the `with:` section. It must begin with `envkey_`.
20
+
The Action looks for environment variables that start with `envkey_` and creates
21
+
an envfile with them. These are defined in the `with` section of the Action
22
+
config. Here is an example of it in use:
10
23
11
24
```yml
12
25
name: Create envfile
@@ -31,14 +44,34 @@ jobs:
31
44
file_name: .env
32
45
```
33
46
34
-
In this example, there are 6 keys:
47
+
## Inputs
48
+
49
+
In the example above, there are several key/value pairs that will be added to
| `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` . |
55
+
| `envkey_SOME_API_KEY` | This one will use a secret stored in the repository's Github Secrets, and add it to the file as `SECRET_KEY` |
56
+
| `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.) |
57
+
| `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
60
+
that is created from the config above would contain:
61
+
62
+
```
63
+
DEBUG: false
64
+
SOME_API_KEY: "123456abcdef"
65
+
SECRET_KEY: password123
66
+
```
37
67
38
-
`envkey_SECRET_KEY`- A secret stored in the repository's Github Secrets
68
+
## Potential Issues
39
69
40
-
`some_other_variable`- Won't be used because it doesn't start with `envkey_`
70
+
### Warnings
41
71
42
-
`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.**)
72
+
When the Action runs, it will show `Warning: Unexpected input(s) ...`. This is
73
+
because Github is expecing all the potential input variables to be defined by
74
+
the Action's definition. You can read more about it in [this
0 commit comments