@socketsecurity/cli-with-sentry 0.14.73 → 0.14.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -911,7 +911,7 @@ function emitBanner(name) {
911
911
  logger.logger.error(getAsciiHeader(name))
912
912
  }
913
913
  function getAsciiHeader(command) {
914
- const cliVersion = '0.14.73:3036c50:ff90e036:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
914
+ const cliVersion = '0.14.75:48886e4:53d4dbe7:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
915
915
  const nodeVersion = process$1.version
916
916
  const apiToken = shadowNpmInject.getDefaultToken()
917
917
  const shownToken = apiToken ? getLastFiveOfApiToken(apiToken) : 'no'
@@ -3189,6 +3189,28 @@ async function commitAndPushFix(branchName, commitMsg, cwd) {
3189
3189
  cwd
3190
3190
  })
3191
3191
  }
3192
+ async function waitForBranchToBeReadable(octokit, owner, repo, branch) {
3193
+ const maxRetries = 10
3194
+ const delay = 1500
3195
+ for (let i = 0; i < maxRetries; i++) {
3196
+ try {
3197
+ // eslint-disable-next-line no-await-in-loop
3198
+ const ref = await octokit.git.getRef({
3199
+ owner,
3200
+ repo,
3201
+ ref: `heads/${branch}`
3202
+ })
3203
+ if (ref) {
3204
+ return
3205
+ }
3206
+ } catch (err) {
3207
+ // Still not ready
3208
+ }
3209
+ // eslint-disable-next-line no-await-in-loop
3210
+ await new Promise(resolve => setTimeout(resolve, delay))
3211
+ }
3212
+ throw new Error(`Branch "${branch}" never became visible to GitHub API`)
3213
+ }
3192
3214
  async function createPullRequest({
3193
3215
  base = 'main',
3194
3216
  body,
@@ -3200,7 +3222,7 @@ async function createPullRequest({
3200
3222
  const octokit = new vendor.Octokit({
3201
3223
  auth: process.env['SOCKET_AUTOFIX_PAT'] ?? process.env['GITHUB_TOKEN']
3202
3224
  })
3203
- await new Promise(resolve => setTimeout(resolve, 3000)) // 3s
3225
+ await waitForBranchToBeReadable(octokit, owner, repo, head)
3204
3226
  await octokit.pulls.create({
3205
3227
  owner,
3206
3228
  repo,
@@ -3346,6 +3368,19 @@ async function pnpmFix(pkgEnvDetails, options) {
3346
3368
  const commitMsg = `fix: upgrade ${name} to ${targetVersion}`
3347
3369
  const { owner, repo } = getRepoInfo()
3348
3370
  // eslint-disable-next-line no-await-in-loop
3371
+ await spawn.spawn(
3372
+ 'git',
3373
+ [
3374
+ 'remote',
3375
+ 'set-url',
3376
+ 'origin',
3377
+ `https://x-access-token:${process.env['SOCKET_AUTOFIX_PAT']}@github.com/${owner}/${repo}`
3378
+ ],
3379
+ {
3380
+ cwd
3381
+ }
3382
+ )
3383
+ // eslint-disable-next-line no-await-in-loop
3349
3384
  await commitAndPushFix(branchName, commitMsg, cwd)
3350
3385
  // eslint-disable-next-line no-await-in-loop
3351
3386
  await createPullRequest({
@@ -11020,7 +11055,7 @@ void (async () => {
11020
11055
  await vendor.updater({
11021
11056
  name: SOCKET_CLI_BIN_NAME,
11022
11057
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
11023
- version: '0.14.73',
11058
+ version: '0.14.75',
11024
11059
  ttl: 86_400_000 /* 24 hours in milliseconds */
11025
11060
  })
11026
11061
  try {
@@ -11091,5 +11126,5 @@ void (async () => {
11091
11126
  await shadowNpmInject.captureException(e)
11092
11127
  }
11093
11128
  })()
11094
- //# debugId=60b0f458-6999-4928-9557-764164ce3eac
11129
+ //# debugId=cef6094c-13b4-47ea-a3bf-21b58cfc911f
11095
11130
  //# sourceMappingURL=cli.js.map