# Code Freeze workflow (vercel/next.js)

> The Code Freeze workflow from vercel/next.js, explained and optimized by Latchkey.

Source: https://latchkey.dev/workflows/vercel-next-js-code-freeze  
Upstream: [vercel/next.js](https://github.com/vercel/next.js/blob/canary/.github/workflows/code_freeze.yml) (.github/workflows/code_freeze.yml), licence MIT

## What it does

This is the Code Freeze workflow from the vercel/next.js repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

## The workflow

```yaml
on:
  workflow_dispatch:
    inputs:
      type:
        description: Enable/disable code freeze
        required: true
        type: choice
        options:
          - enable
          - disable

    secrets:
      CODE_FREEZE_TOKEN:
        required: true

name: Code Freeze

env:
  NAPI_CLI_VERSION: 2.18.4
  TURBO_VERSION: 2.9.4
  NODE_LTS_VERSION: 20

jobs:
  start:
    runs-on: ubuntu-latest

    environment: release-${{ github.event.inputs.releaseType }}
    steps:
      - name: Setup node
        uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
        with:
          node-version: ${{ env.NODE_LTS_VERSION }}
          check-latest: true
          package-manager-cache: false
      - name: Setup corepack
        run: |
          npm i -g corepack@0.31
          corepack enable

      - run: git clone https://github.com/vercel/next.js.git --depth=1 .

      # https://github.com/actions/virtual-environments/issues/1187
      - name: tune linux network
        run: sudo ethtool -K eth0 tx off rx off

      - run: node ./scripts/code-freeze.js --type "${INPUT_TYPE}"
        env:
          CODE_FREEZE_TOKEN: ${{ secrets.CODE_FREEZE_TOKEN }}
          INPUT_TYPE: ${{ github.event.inputs.type }}
```

## FAQ

### What does the Code Freeze workflow (vercel/next.js) workflow do?

This is the Code Freeze workflow from the vercel/next.js repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

### What CI health grade does this workflow get?

This Node.js workflow grades C. Paste your own workflow into the Latchkey grader to see its grade and the exact fixes.

### How can I improve this Node.js workflow?

Add caching and job timeouts. Latchkey applies these automatically on managed runners when you point runs-on at Latchkey.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
