Skip to content

Commit d5f2fb2

Browse files
committed
Cleanup vars in fix command
1 parent db2fecb commit d5f2fb2

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

src/commands/fix/npm-fix.mts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,17 @@ export async function npmFix(
111111
const { pkgPath: rootPath } = pkgEnvDetails
112112

113113
// Lazily access constants.ENV properties.
114-
const token = constants.ENV.SOCKET_CLI_GITHUB_TOKEN
114+
const gitEmail = constants.ENV.SOCKET_CLI_GIT_USER_EMAIL
115+
const gitUser = constants.ENV.SOCKET_CLI_GIT_USER_NAME
116+
const githubToken = constants.ENV.SOCKET_CLI_GITHUB_TOKEN
117+
115118
const isCi = !!(
116119
constants.ENV.CI &&
117120
constants.ENV.GITHUB_ACTIONS &&
118121
constants.ENV.GITHUB_REPOSITORY &&
119-
token
122+
gitEmail &&
123+
gitUser &&
124+
githubToken
120125
)
121126

122127
spinner?.start()
@@ -127,8 +132,7 @@ export async function npmFix(
127132
repoInfo = getGitHubEnvRepoInfo()!
128133
count += (
129134
await getOpenSocketPrs(repoInfo.owner, repoInfo.repo, {
130-
// Lazily access constants.ENV.SOCKET_CLI_GIT_USER_NAME.
131-
author: constants.ENV.SOCKET_CLI_GIT_USER_NAME,
135+
author: gitUser,
132136
})
133137
).length
134138
}
@@ -414,6 +418,8 @@ export async function npmFix(
414418
moddedFilepaths,
415419
{
416420
cwd,
421+
email: gitEmail,
422+
user: gitUser,
417423
},
418424
))
419425
) {
@@ -440,7 +446,7 @@ export async function npmFix(
440446
setGitRemoteGitHubRepoUrl(
441447
repoInfo!.owner,
442448
repoInfo!.repo,
443-
token,
449+
githubToken,
444450
cwd,
445451
),
446452
cleanupOpenPrs(repoInfo!.owner, repoInfo!.repo, newVersion, {

src/commands/fix/pnpm-fix.mts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,17 @@ export async function pnpmFix(
141141
const { pkgPath: rootPath } = pkgEnvDetails
142142

143143
// Lazily access constants.ENV properties.
144-
const token = constants.ENV.SOCKET_CLI_GITHUB_TOKEN
144+
const gitEmail = constants.ENV.SOCKET_CLI_GIT_USER_EMAIL
145+
const gitUser = constants.ENV.SOCKET_CLI_GIT_USER_NAME
146+
const githubToken = constants.ENV.SOCKET_CLI_GITHUB_TOKEN
147+
145148
const isCi = !!(
146149
constants.ENV.CI &&
147150
constants.ENV.GITHUB_ACTIONS &&
148151
constants.ENV.GITHUB_REPOSITORY &&
149-
token
152+
gitEmail &&
153+
gitUser &&
154+
githubToken
150155
)
151156

152157
spinner?.start()
@@ -157,8 +162,7 @@ export async function pnpmFix(
157162
repoInfo = getGitHubEnvRepoInfo()!
158163
count += (
159164
await getOpenSocketPrs(repoInfo.owner, repoInfo.repo, {
160-
// Lazily access constants.ENV.SOCKET_CLI_GIT_USER_NAME.
161-
author: constants.ENV.SOCKET_CLI_GIT_USER_NAME,
165+
author: gitUser,
162166
})
163167
).length
164168
}
@@ -579,6 +583,8 @@ export async function pnpmFix(
579583
moddedFilepaths,
580584
{
581585
cwd,
586+
email: gitEmail,
587+
user: gitUser,
582588
},
583589
))
584590
) {
@@ -613,7 +619,7 @@ export async function pnpmFix(
613619
setGitRemoteGitHubRepoUrl(
614620
repoInfo!.owner,
615621
repoInfo!.repo,
616-
token,
622+
githubToken,
617623
cwd,
618624
),
619625
cleanupOpenPrs(repoInfo!.owner, repoInfo!.repo, newVersion, {

0 commit comments

Comments
 (0)