File tree 2 files changed +24
-9
lines changed 2 files changed +24
-9
lines changed Original file line number Diff line number Diff line change @@ -94,15 +94,30 @@ export const FORMULA_KEYS = [
94
94
] ;
95
95
96
96
export const GOOGLE_SHEET_ID = ( ) => {
97
- let sheetId ;
98
-
99
- if ( shadowConfigDetails && shadowConfigDetails . googleSpreadsheetId ) {
100
- sheetId = shadowConfigDetails . googleSpreadsheetId
101
- . split ( '/d/' ) [ 1 ]
102
- . split ( '/' ) [ 0 ] ;
103
- } else {
104
- sheetId = false ;
97
+ let sheetId = '' ;
98
+
99
+ if (
100
+ shadowConfigDetails &&
101
+ typeof shadowConfigDetails . googleSpreadsheetId === 'string'
102
+ ) {
103
+ const envVarMatch = shadowConfigDetails . googleSpreadsheetId . match (
104
+ / ^ p r o c e s s \. e n v \. ( \w + ) $ /
105
+ ) ;
106
+
107
+ if ( envVarMatch ) {
108
+ const envVarName = envVarMatch [ 1 ] ; // Extract the environment variable name (e.g., 'SHEET_ID')
109
+
110
+ // Check if the environment variable exists in process.env
111
+ if ( process . env [ envVarName ] ) {
112
+ sheetId = process . env [ envVarName ] . split ( '/d/' ) [ 1 ] . split ( '/' ) [ 0 ] || '' ; // Set the value from process.env
113
+ }
114
+ } else {
115
+ sheetId = shadowConfigDetails . googleSpreadsheetId
116
+ . split ( '/d/' ) [ 1 ]
117
+ . split ( '/' ) [ 0 ] ; // Use the raw config value if it's not an environment variable
118
+ }
105
119
}
120
+
106
121
return sheetId ;
107
122
} ;
108
123
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " qa-shadow-report" ,
3
- "version" : " 1.1.31 " ,
3
+ "version" : " 1.1.32 " ,
4
4
"bin" : {
5
5
"qa-shadow-report" : " ./cli.js" ,
6
6
"qasr" : " ./cli.js" ,
You can’t perform that action at this time.
0 commit comments