1- import { debugFn } from '@socketsecurity/registry/lib/debug'
1+ import { joinAnd } from '@socketsecurity/registry/lib/arrays'
2+ import { debugFn , isDebug } from '@socketsecurity/registry/lib/debug'
23
34import { getSocketPrs } from './pull-request.mts'
45import constants from '../../constants.mts'
@@ -40,6 +41,27 @@ export async function getFixEnv(): Promise<FixEnv> {
4041 const gitUser = constants . ENV . SOCKET_CLI_GIT_USER_NAME
4142 const githubToken = constants . ENV . SOCKET_CLI_GITHUB_TOKEN
4243 const isCi = ! ! ( constants . ENV . CI && gitEmail && gitUser && githubToken )
44+
45+ if (
46+ // If isCi is false,
47+ ! isCi &&
48+ // but some CI checks are passing,
49+ ( constants . ENV . CI || gitEmail || gitUser || githubToken ) &&
50+ // then log about it when in debug mode.
51+ isDebug ( 'notice' )
52+ ) {
53+ const things = [
54+ ...( constants . ENV . CI ? [ ] : [ 'process.env.CI' ] ) ,
55+ ...( gitEmail ? [ ] : [ 'process.env.SOCKET_CLI_GIT_USER_EMAIL' ] ) ,
56+ ...( gitUser ? [ ] : [ 'process.env.SOCKET_CLI_GIT_USER_NAME' ] ) ,
57+ ...( githubToken ? [ ] : [ 'process.env.GITHUB_TOKEN' ] ) ,
58+ ]
59+ debugFn (
60+ 'notice' ,
61+ `miss: fixEnv.isCi is false, expected ${ joinAnd ( things ) } to be set` ,
62+ )
63+ }
64+
4365 let repoInfo : RepoInfo | null = null
4466 if ( isCi ) {
4567 repoInfo = ciRepoInfo ( )
@@ -50,13 +72,15 @@ export async function getFixEnv(): Promise<FixEnv> {
5072 }
5173 repoInfo = await getRepoInfo ( )
5274 }
75+
5376 const prs =
5477 isCi && repoInfo
5578 ? await getSocketPrs ( repoInfo . owner , repoInfo . repo , {
5679 author : gitUser ,
5780 states : 'all' ,
5881 } )
5982 : [ ]
83+
6084 return {
6185 baseBranch,
6286 gitEmail,
0 commit comments