File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change
1
+ const fs = require ( "fs" ) ;
2
+
3
+ let dotenv_action = function ( dotenvFile , keysCase ) {
4
+ if ( ! fs . existsSync ( dotenvFile ) ) {
5
+ throw new Error ( "file does not exist" ) ;
6
+ }
7
+
8
+ const dotenv = require ( "dotenv" ) . config ( { path : dotenvFile } ) ;
9
+ const dotenv_expand = require ( "dotenv-expand" ) . expand ( dotenv ) ;
10
+ console . log ( "loading .env file from " + dotenvFile ) ;
11
+
12
+ const returnedMap = { } ;
13
+ for ( const key in dotenv_expand . parsed ) {
14
+ const value = dotenv_expand . parsed [ key ] ;
15
+
16
+ if ( keysCase == "bypass" ) {
17
+ returnedMap [ key ] = value ;
18
+ } else if ( keysCase == "upper" ) {
19
+ returnedMap [ key . toLocaleUpperCase ( ) ] = value ;
20
+ } else {
21
+ returnedMap [ key . toLocaleLowerCase ( ) ] = value ;
22
+ }
23
+ }
24
+ return returnedMap ;
25
+ } ;
26
+
27
+ module . exports = dotenv_action ;
Original file line number Diff line number Diff line change 66
66
67
67
- name : DotEnv file
68
68
id : dotenv
69
- uses : actions/dotenv-action
69
+ uses : ./.github/ actions/dotenv-action
70
70
71
71
- name : Checkout repository
72
72
uses : actions/checkout@v4
You can’t perform that action at this time.
0 commit comments