Skip to content

Commit 78e20f1

Browse files
committed
Add error message for invalid token permissions
1 parent 7e76e5a commit 78e20f1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/utils/git.mts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { debugDir, debugFn, isDebug } from '@socketsecurity/registry/lib/debug'
22
import { normalizePath } from '@socketsecurity/registry/lib/path'
3-
import { spawn } from '@socketsecurity/registry/lib/spawn'
3+
import { isSpawnError, spawn } from '@socketsecurity/registry/lib/spawn'
44

55
import constants from '../constants.mts'
66

@@ -159,6 +159,12 @@ export async function gitPushBranch(
159159
'error',
160160
`caught: git push --force --set-upstream origin ${branch} failed`,
161161
)
162+
if (isSpawnError(e) && e.code === 128) {
163+
debugFn(
164+
'error',
165+
'denied: token requires contents: write; pull-requests: write permissions',
166+
)
167+
}
162168
debugDir('inspect', { error: e })
163169
}
164170
return false

0 commit comments

Comments
 (0)