Skip to content

Commit 8b4c701

Browse files
chore: set config by env
1 parent 9dd2ebc commit 8b4c701

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

__tests__/utils2.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,16 @@ describe('replaceVariables', () => {
267267
describe('isCommandDebug', () => {
268268
testEnv();
269269

270-
it('should return true', () => {
270+
it('should return true 1', () => {
271271
process.env.INPUT_UTILS_COMMAND_DEBUG = 'true';
272272
expect(isCommandDebug()).toBe(true);
273273
});
274274

275+
it('should return true 2', () => {
276+
process.env.UTILS_COMMAND_DEBUG = 'true';
277+
expect(isCommandDebug()).toBe(true);
278+
});
279+
275280
it('should return false 1', () => {
276281
expect(isCommandDebug()).toBe(false);
277282
});
@@ -290,6 +295,11 @@ describe('isCommandDebug', () => {
290295
process.env.INPUT_UTILS_COMMAND_DEBUG = 'abc';
291296
expect(isCommandDebug()).toBe(false);
292297
});
298+
299+
it('should return false 5', () => {
300+
process.env.UTILS_COMMAND_DEBUG = '';
301+
expect(isCommandDebug()).toBe(false);
302+
});
293303
});
294304

295305
describe('isOutputDebug', () => {

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,9 @@ export const replaceVariables = async(string: string, variables: { key: string;
253253
return replaced;
254254
};
255255

256-
export const isCommandDebug = (): boolean => getInput('UTILS_COMMAND_DEBUG') === 'true';
256+
export const isCommandDebug = (): boolean => getInput('UTILS_COMMAND_DEBUG') === 'true' || process.env.UTILS_COMMAND_DEBUG === 'true';
257257

258-
export const isOutputDebug = (): boolean => getInput('UTILS_OUTPUT_DEBUG') === 'true';
258+
export const isOutputDebug = (): boolean => getInput('UTILS_OUTPUT_DEBUG') === 'true' || process.env.UTILS_OUTPUT_DEBUG === 'true';
259259

260260
// eslint-disable-next-line @typescript-eslint/no-explicit-any
261261
export const objectGet = <T>(value: { [key: string]: any } | undefined | null, key: string, defaultValue?: T): T | undefined => {

0 commit comments

Comments
 (0)