@socketsecurity/cli-with-sentry 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.
@@ -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.74:e430910:86507715:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
914
+ const cliVersion = '0.14.76:c0c2e5d:20f4620f: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,
@@ -3352,7 +3374,7 @@ async function pnpmFix(pkgEnvDetails, options) {
3352
3374
  'remote',
3353
3375
  'set-url',
3354
3376
  'origin',
3355
- `https://x-access-token:${process.env['SOCKET_AUTOFIX_PAT']}@github.com/${owner}/${repo}`
3377
+ `https://x-access-token:${process.env['SOCKET_AUTOFIX_PAT'] ?? process.env['GITHUB_TOKEN']}@github.com/${owner}/${repo}`
3356
3378
  ],
3357
3379
  {
3358
3380
  cwd
@@ -11033,7 +11055,7 @@ void (async () => {
11033
11055
  await vendor.updater({
11034
11056
  name: SOCKET_CLI_BIN_NAME,
11035
11057
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
11036
- version: '0.14.74',
11058
+ version: '0.14.76',
11037
11059
  ttl: 86_400_000 /* 24 hours in milliseconds */
11038
11060
  })
11039
11061
  try {
@@ -11104,5 +11126,5 @@ void (async () => {
11104
11126
  await shadowNpmInject.captureException(e)
11105
11127
  }
11106
11128
  })()
11107
- //# debugId=653d2927-6580-43c1-bcbd-ad6cc485f8de
11129
+ //# debugId=300c895d-4910-46ce-8841-f1d829d36af7
11108
11130
  //# sourceMappingURL=cli.js.map