Skip to content

release: v5.0.0 #354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions __tests__/git-helper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ describe('GitHelper', () => {
await helper.push(workDir, 'test-branch', context(), {withTag: true, args: ['--prune', '--verbose']});

execCalledWith(mockExec, [
'git push --tags --prune --verbose \'https://octocat:[email protected]/hello/world.git\' \'test-branch:refs/heads/test-branch\' || :',
'git push --tags --prune --verbose \'https://octocat:[email protected]/hello/world.git\' \'test-branch:refs/heads/test-branch\'',
]);
});

Expand All @@ -663,7 +663,7 @@ describe('GitHelper', () => {
await helper.push(workDir, 'test-branch', context());

execCalledWith(mockExec, [
'git push \'https://octocat:[email protected]/hello/world.git\' \'test-branch:refs/heads/test-branch\' || :',
'git push \'https://octocat:[email protected]/hello/world.git\' \'test-branch:refs/heads/test-branch\'',
]);
});
});
Expand All @@ -675,7 +675,7 @@ describe('GitHelper', () => {
await helper.forcePush(workDir, 'test-branch', context());

execCalledWith(mockExec, [
'git push --force \'https://octocat:[email protected]/hello/world.git\' \'test-branch:refs/heads/test-branch\' || :',
'git push --force \'https://octocat:[email protected]/hello/world.git\' \'test-branch:refs/heads/test-branch\'',
]);
});
});
Expand Down
12 changes: 11 additions & 1 deletion __tests__/utils2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,16 @@ describe('replaceVariables', () => {
describe('isCommandDebug', () => {
testEnv();

it('should return true', () => {
it('should return true 1', () => {
process.env.INPUT_UTILS_COMMAND_DEBUG = 'true';
expect(isCommandDebug()).toBe(true);
});

it('should return true 2', () => {
process.env.UTILS_COMMAND_DEBUG = 'true';
expect(isCommandDebug()).toBe(true);
});

it('should return false 1', () => {
expect(isCommandDebug()).toBe(false);
});
Expand All @@ -290,6 +295,11 @@ describe('isCommandDebug', () => {
process.env.INPUT_UTILS_COMMAND_DEBUG = 'abc';
expect(isCommandDebug()).toBe(false);
});

it('should return false 5', () => {
process.env.UTILS_COMMAND_DEBUG = '';
expect(isCommandDebug()).toBe(false);
});
});

describe('isOutputDebug', () => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@technote-space/github-action-helper",
"version": "4.4.11",
"version": "5.0.0",
"description": "Helper for GitHub Action.",
"keywords": [
"github",
Expand Down
1 change: 0 additions & 1 deletion src/git-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,6 @@ export default class GitHelper {
args: args.concat([this.getRemote(context), `${branch}:refs/heads/${branch}`]),
stderrToStdout: this.isQuiet(),
altCommand: `git push ${args.concat([this.getRemoteName(), `${branch}:refs/heads/${branch}`]).join(' ')}`,
suppressError: this.shouldSuppressError(),
});
};

Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ export const replaceVariables = async(string: string, variables: { key: string;
return replaced;
};

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

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

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