socket 0.14.74 → 0.14.76

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.74:e430910:1d68f7d1:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
917
+ const cliVersion = '0.14.76:c0c2e5d:cebdd6b8: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,
@@ -3351,7 +3373,7 @@ async function pnpmFix(pkgEnvDetails, options) {
3351
3373
  'remote',
3352
3374
  'set-url',
3353
3375
  'origin',
3354
- `https://x-access-token:${process.env['SOCKET_AUTOFIX_PAT']}@github.com/${owner}/${repo}`
3376
+ `https://x-access-token:${process.env['SOCKET_AUTOFIX_PAT'] ?? process.env['GITHUB_TOKEN']}@github.com/${owner}/${repo}`
3355
3377
  ],
3356
3378
  {
3357
3379
  cwd
@@ -11030,7 +11052,7 @@ void (async () => {
11030
11052
  await updateNotifier({
11031
11053
  name: SOCKET_CLI_BIN_NAME,
11032
11054
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
11033
- version: '0.14.74',
11055
+ version: '0.14.76',
11034
11056
  ttl: 86_400_000 /* 24 hours in milliseconds */
11035
11057
  })
11036
11058
  try {
@@ -11101,5 +11123,5 @@ void (async () => {
11101
11123
  await shadowNpmInject.captureException(e)
11102
11124
  }
11103
11125
  })()
11104
- //# debugId=41229246-2f4d-4389-a72e-22e243adcc29
11126
+ //# debugId=7b5e4128-ae18-4469-a1c0-b42618fc580c
11105
11127
  //# sourceMappingURL=cli.js.map