Skip to content

Commit

Permalink
šŸ› fix(cli.ts, github-action.ts, config.ts, prepare-commit-msg-hook.tsā€¦
Browse files Browse the repository at this point in the history
ā€¦): rename OCO_GIT_PUSH to OCO_DISABLE_GIT_PUSH for clarity

The OCO_GIT_PUSH environment variable has been renamed to OCO_DISABLE_GIT_PUSH to better reflect its purpose. The variable now disables git push when set to true. This change has been made in multiple files to ensure consistency across the codebase.
  • Loading branch information
takuya-o committed May 29, 2023
1 parent 616c993 commit b0d47a2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions out/cli.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -17654,9 +17654,9 @@ var configValidators = {
);
return value;
},
["OCO_GIT_PUSH" /* OCO_GIT_PUSH */](value) {
["OCO_DISABLE_GIT_PUSH" /* OCO_DISABLE_GIT_PUSH */](value) {
validateConfig(
"OCO_GIT_PUSH" /* OCO_GIT_PUSH */,
"OCO_DISABLE_GIT_PUSH" /* OCO_DISABLE_GIT_PUSH */,
typeof value === "boolean",
"Must be true or false"
);
Expand Down Expand Up @@ -17721,7 +17721,7 @@ var getConfig = () => {
OCO_EMOJI: process.env.OCO_EMOJI === "true" ? true : false,
OCO_MODEL: process.env.OCO_MODEL || "gpt-3.5-turbo",
OCO_LANGUAGE: process.env.OCO_LANGUAGE || "en",
OCO_GIT_PUSH: process.env.OCO_GITPUSH === "true" ? true : false,
OCO_DISABLE_GIT_PUSH: process.env.OCO_DISABLE_GITPUSH === "true" ? true : false,
OCO_PREFIX: process.env.OCO_PREFIX || ""
};
const configExists = (0, import_fs.existsSync)(configPath);
Expand Down Expand Up @@ -22098,7 +22098,7 @@ ${source_default.grey("\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2
]);
ce(`${source_default.green("\u2714")} Successfully committed`);
ce(stdout);
if (config4?.OCO_GIT_PUSH === false)
if (config4?.OCO_DISABLE_GIT_PUSH === true)
return;
const remotes = await getGitRemotes();
if (!remotes.length) {
Expand Down
6 changes: 3 additions & 3 deletions out/github-action.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27676,9 +27676,9 @@ var configValidators = {
);
return value;
},
["OCO_GIT_PUSH" /* OCO_GIT_PUSH */](value) {
["OCO_DISABLE_GIT_PUSH" /* OCO_DISABLE_GIT_PUSH */](value) {
validateConfig(
"OCO_GIT_PUSH" /* OCO_GIT_PUSH */,
"OCO_DISABLE_GIT_PUSH" /* OCO_DISABLE_GIT_PUSH */,
typeof value === "boolean",
"Must be true or false"
);
Expand Down Expand Up @@ -27743,7 +27743,7 @@ var getConfig = () => {
OCO_EMOJI: process.env.OCO_EMOJI === "true" ? true : false,
OCO_MODEL: process.env.OCO_MODEL || "gpt-3.5-turbo",
OCO_LANGUAGE: process.env.OCO_LANGUAGE || "en",
OCO_GIT_PUSH: process.env.OCO_GITPUSH === "true" ? true : false,
OCO_DISABLE_GIT_PUSH: process.env.OCO_DISABLE_GITPUSH === "true" ? true : false,
OCO_PREFIX: process.env.OCO_PREFIX || ""
};
const configExists = (0, import_fs.existsSync)(configPath);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/commit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ ${chalk.grey('ā€”ā€”ā€”ā€”ā€”ā€”ā€”ā€”ā€”ā€”ā€”ā€”ā€”ā€”ā€”ā€”ā€”ā€”')}`
outro(stdout);

// user isn't pushing, return early
if(config?.OCO_GIT_PUSH === false) return
if(config?.OCO_DISABLE_GIT_PUSH === true) return

const remotes = await getGitRemotes();

Expand Down
8 changes: 4 additions & 4 deletions src/commands/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export enum CONFIG_KEYS {
OCO_EMOJI = 'OCO_EMOJI',
OCO_MODEL = 'OCO_MODEL',
OCO_LANGUAGE = 'OCO_LANGUAGE',
OCO_GIT_PUSH = 'OCO_GIT_PUSH',
OCO_DISABLE_GIT_PUSH = 'OCO_DISABLE_GIT_PUSH',
OCO_PREFIX = 'OCO_PREFIX'
}

Expand Down Expand Up @@ -102,9 +102,9 @@ export const configValidators = {

return value;
},
[CONFIG_KEYS.OCO_GIT_PUSH](value: any) {
[CONFIG_KEYS.OCO_DISABLE_GIT_PUSH](value: any) {
validateConfig(
CONFIG_KEYS.OCO_GIT_PUSH,
CONFIG_KEYS.OCO_DISABLE_GIT_PUSH,
typeof value === 'boolean',
'Must be true or false'
);
Expand Down Expand Up @@ -182,7 +182,7 @@ export const getConfig = (): ConfigType | null => {
OCO_EMOJI: process.env.OCO_EMOJI === 'true' ? true : false,
OCO_MODEL: process.env.OCO_MODEL || 'gpt-3.5-turbo',
OCO_LANGUAGE: process.env.OCO_LANGUAGE || 'en',
OCO_GIT_PUSH: process.env.OCO_GITPUSH === 'true' ? true : false,
OCO_DISABLE_GIT_PUSH: process.env.OCO_DISABLE_GITPUSH === 'true' ? true : false,
OCO_PREFIX: process.env.OCO_PREFIX || '',
};

Expand Down
2 changes: 1 addition & 1 deletion src/commands/prepare-commit-msg-hook.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs/promises';
import chalk from 'chalk';
import { intro, outro, spinner } from '@clack/prompts';
import { getChangedFiles, getDiff, getStagedFiles, gitAdd, getCurrentGitBranch } from '../utils/git';
import { getChangedFiles, getDiff, getStagedFiles, gitAdd } from '../utils/git';
import { getConfig } from './config';
import { generateCommitMessageByDiff } from '../generateCommitMessageFromGitDiff';

Expand Down

0 comments on commit b0d47a2

Please sign in to comment.