socket 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.
@@ -914,7 +914,7 @@ function emitBanner(name) {
914
914
  logger.logger.error(getAsciiHeader(name))
915
915
  }
916
916
  function getAsciiHeader(command) {
917
- const cliVersion = '0.14.73:3036c50:59a58dfc:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
917
+ const cliVersion = '0.14.75:48886e4:6e7b3271:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
918
918
  const nodeVersion = process$1.version
919
919
  const apiToken = shadowNpmInject.getDefaultToken()
920
920
  const shownToken = apiToken ? getLastFiveOfApiToken(apiToken) : 'no'
@@ -3188,6 +3188,28 @@ async function commitAndPushFix(branchName, commitMsg, cwd) {
3188
3188
  cwd
3189
3189
  })
3190
3190
  }
3191
+ async function waitForBranchToBeReadable(octokit, owner, repo, branch) {
3192
+ const maxRetries = 10
3193
+ const delay = 1500
3194
+ for (let i = 0; i < maxRetries; i++) {
3195
+ try {
3196
+ // eslint-disable-next-line no-await-in-loop
3197
+ const ref = await octokit.git.getRef({
3198
+ owner,
3199
+ repo,
3200
+ ref: `heads/${branch}`
3201
+ })
3202
+ if (ref) {
3203
+ return
3204
+ }
3205
+ } catch (err) {
3206
+ // Still not ready
3207
+ }
3208
+ // eslint-disable-next-line no-await-in-loop
3209
+ await new Promise(resolve => setTimeout(resolve, delay))
3210
+ }
3211
+ throw new Error(`Branch "${branch}" never became visible to GitHub API`)
3212
+ }
3191
3213
  async function createPullRequest({
3192
3214
  base = 'main',
3193
3215
  body,
@@ -3199,7 +3221,7 @@ async function createPullRequest({
3199
3221
  const octokit = new rest.Octokit({
3200
3222
  auth: process.env['SOCKET_AUTOFIX_PAT'] ?? process.env['GITHUB_TOKEN']
3201
3223
  })
3202
- await new Promise(resolve => setTimeout(resolve, 3000)) // 3s
3224
+ await waitForBranchToBeReadable(octokit, owner, repo, head)
3203
3225
  await octokit.pulls.create({
3204
3226
  owner,
3205
3227
  repo,
@@ -3345,6 +3367,19 @@ async function pnpmFix(pkgEnvDetails, options) {
3345
3367
  const commitMsg = `fix: upgrade ${name} to ${targetVersion}`
3346
3368
  const { owner, repo } = getRepoInfo()
3347
3369
  // eslint-disable-next-line no-await-in-loop
3370
+ await spawn.spawn(
3371
+ 'git',
3372
+ [
3373
+ 'remote',
3374
+ 'set-url',
3375
+ 'origin',
3376
+ `https://x-access-token:${process.env['SOCKET_AUTOFIX_PAT']}@github.com/${owner}/${repo}`
3377
+ ],
3378
+ {
3379
+ cwd
3380
+ }
3381
+ )
3382
+ // eslint-disable-next-line no-await-in-loop
3348
3383
  await commitAndPushFix(branchName, commitMsg, cwd)
3349
3384
  // eslint-disable-next-line no-await-in-loop
3350
3385
  await createPullRequest({
@@ -11017,7 +11052,7 @@ void (async () => {
11017
11052
  await updateNotifier({
11018
11053
  name: SOCKET_CLI_BIN_NAME,
11019
11054
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
11020
- version: '0.14.73',
11055
+ version: '0.14.75',
11021
11056
  ttl: 86_400_000 /* 24 hours in milliseconds */
11022
11057
  })
11023
11058
  try {
@@ -11088,5 +11123,5 @@ void (async () => {
11088
11123
  await shadowNpmInject.captureException(e)
11089
11124
  }
11090
11125
  })()
11091
- //# debugId=395d1a74-57c0-4afb-971d-1c8e99178d08
11126
+ //# debugId=7630343d-7c9b-4855-97fe-c61e77360d9c
11092
11127
  //# sourceMappingURL=cli.js.map