Repository: vercel/next.js
Pull request: Update create-release-branch to disable test-new-tests

This updates to disable the `test-new-tests-` jobs for release branches as they have a lot of diffs and can stall CI heavily un-necessarily. 

Changed files:
filename: .github/workflows/build_and_test.yml
patch: @@ -544,7 +544,9 @@ jobs:
   test-new-tests-dev:
     name: Test new tests for flakes (dev)
     needs: ['optimize-ci', 'changes', 'build-native', 'build-next']
+    # test-new-tests-if
     if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' }}
+    # test-new-tests-end-if
 
     strategy:
       fail-fast: false
@@ -566,7 +568,9 @@ jobs:
   test-new-tests-start:
     name: Test new tests for flakes (prod)
     needs: ['optimize-ci', 'changes', 'build-native', 'build-next']
+    # test-new-tests-if
     if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' }}
+    # test-new-tests-end-if
 
     strategy:
       fail-fast: false
@@ -582,14 +586,15 @@ jobs:
           --group ${{ matrix.group }}
       stepName: 'test-new-tests-start-${{matrix.group}}'
       timeout_minutes: 60 # Increase the default timeout as tests are intentionally run multiple times to detect flakes
-
     secrets: inherit
 
   test-new-tests-deploy:
     name: Test new tests when deployed
     needs:
       ['optimize-ci', 'test-prod', 'test-new-tests-dev', 'test-new-tests-start']
+    # test-new-tests-if
     if: ${{ needs.optimize-ci.outputs.skip == 'false' }}
+    # test-new-tests-end-if
 
     strategy:
       fail-fast: false

filename: scripts/create-release-branch.js
patch: @@ -2,7 +2,6 @@
 const fs = require('fs')
 const path = require('path')
 const execa = require('execa')
-const resolveFrom = require('resolve-from')
 
 async function main() {
   const args = process.argv
@@ -24,15 +23,6 @@ async function main() {
     return
   }
 
-  const configStorePath = resolveFrom(
-    path.join(process.cwd(), 'node_modules/release'),
-    'configstore'
-  )
-  const ConfigStore = require(configStorePath)
-
-  const config = new ConfigStore('release')
-  config.set('token', githubToken)
-
   await execa(
     `git remote set-url origin https://nextjs-bot:${githubToken}@github.com/vercel/next.js.git`,
     { stdio: 'inherit', shell: true }
@@ -81,12 +71,19 @@ async function main() {
     'workflows',
     'build_and_test.yml'
   )
-  const buildAndTest = await fs.promises.readFile(buildAndTestPath, 'utf8')
-  await fs.promises.writeFile(
-    buildAndTestPath,
-    buildAndTest.replace(`['canary']`, `['${branchName}']`)
+  let buildAndTest = await fs.promises.readFile(buildAndTestPath, 'utf8')
+  buildAndTest = buildAndTest
+    .replace(`['canary']`, `['${branchName}']`)
+    .replace(/[\s]{1,}('test-new-tests-.+',)/g, '')
+
+  buildAndTest = buildAndTest.replace(
+    /(^[ \t]*)# test-new-tests-if\n(^[ \t]*)if:.*\n(^[ \t]*)# test-new-tests-end-if/gm,
+    (_, indent1, indent2, indent3) =>
+      `${indent1}# test-new-tests-if\n${indent2}if: false\n${indent3}# test-new-tests-end-if`
   )
 
+  await fs.promises.writeFile(buildAndTestPath, buildAndTest)
+
   await execa(`git add .`, {
     stdio: 'inherit',
     shell: true,