Skip to content

chore: keep generated templates when the starter repo is unreachable - #1447

Merged
danielroe merged 1 commit into
refactor/actionablefrom
chore/templates
Aug 12, 2026
Merged

chore: keep generated templates when the starter repo is unreachable#1447
danielroe merged 1 commit into
refactor/actionablefrom
chore/templates

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

📚 Description

small chore - avoids failures when running pnpm install locally and hitting a github rate limit

@pkg-pr-new

pkg-pr-new Bot commented Aug 12, 2026

Copy link
Copy Markdown
  • nuxt-cli-playground

    npm i https://pkg.pr.new/create-nuxt@1447
    
    npm i https://pkg.pr.new/nuxi@1447
    
    npm i https://pkg.pr.new/@nuxt/cli@1447
    

commit: bbe5bb2

@codspeed-hq

codspeed-hq Bot commented Aug 12, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing chore/templates (bbe5bb2) with refactor/actionable (96ee7bb)

Open in CodSpeed

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@danielroe, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 11 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 15d0ccb4-1fa8-4b0a-b2c5-d603381be029

📥 Commits

Reviewing files that changed from the base of the PR and between b86fc51 and bbe5bb2.

📒 Files selected for processing (1)
  • .github/workflows/release.yml
📝 Walkthrough

Walkthrough

The release workflow now exposes GITHUB_TOKEN during dependency installation. The data generator now uses a shared templates file path, detects CI execution, preserves an existing templates file after non-CI fetch failures, and rethrows failures when required. Successful template fetches continue to rewrite the file.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes preserving generated templates when the starter repository is unreachable.
Description check ✅ Passed The description explains that the change prevents local pnpm install failures caused by GitHub rate limits.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/templates

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release.yml:
- Around line 79-80: Update the release workflow so the install step runs pnpm
install --frozen-lockfile --ignore-scripts without GITHUB_TOKEN, then invoke
generate-data.ts in a separate token-scoped step, and run pnpm build in a step
without the token. Remove or bypass the current postinstall flow that combines
generation and building during dependency installation, while preserving the
required command order.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9359bc10-3c1b-4921-b73d-c7636d436790

📥 Commits

Reviewing files that changed from the base of the PR and between 3344516 and b86fc51.

📒 Files selected for processing (2)
  • .github/workflows/release.yml
  • scripts/generate-data.ts

Comment on lines +79 to +80
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- workflow context ---'
sed -n '1,130p' .github/workflows/release.yml

printf '%s\n' '--- tracked package manifests ---'
git ls-files '*package.json' '*pnpm-lock.yaml' | sed -n '1,120p'

printf '%s\n' '--- lifecycle and token references ---'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' \
  'GITHUB_TOKEN|generate-data|postinstall|preinstall|prepare' .

Repository: nuxt/cli

Length of output: 9652


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- root package manifest ---'
cat -n package.json | sed -n '1,110p'

printf '%s\n' '--- generator and token consumer ---'
fd -t f -a 'generate-data.ts|starter-templates.ts|fetch.ts' .
for f in $(fd -t f -a 'generate-data.ts|starter-templates.ts|fetch.ts' .); do
  printf '\n--- %s ---\n' "$f"
  wc -l "$f"
  cat -n "$f" | sed -n '1,240p'
done

printf '%s\n' '--- package-manager configuration and versions ---'
fd -t f -a -i 'pnpm*|*.npmrc|package.json' . | sed -n '1,160p'
rg -n --hidden --glob '!node_modules' \
  'packageManager|engine-strict|ignore-scripts|onlyBuiltDependencies|neverBuiltDependencies|approve-builds|supportedArchitectures' \
  package.json pnpm-workspace.yaml .npmrc .github scripts packages 2>/dev/null || true

Repository: nuxt/cli

Length of output: 29321


🏁 Script executed:

#!/bin/bash
set -eu

python3 - <<'PY'
from pathlib import Path
import json
import re

workflow = Path(".github/workflows/release.yml").read_text()
manifest = json.loads(Path("package.json").read_text())
generator = Path("scripts/generate-data.ts").read_text()
templates = Path("packages/nuxt-cli/src/utils/starter-templates.ts").read_text()

assert "permissions: {}" in workflow
install = re.search(
    r"- name: 📦 Install dependencies(?P<body>.*?)(?=\n\s{6}- id: pack\b)",
    workflow,
    re.S,
)
assert install, "pack install step not found"
install_body = install.group("body")
assert "run: pnpm install --frozen-lockfile" in install_body
assert "GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}" in install_body
assert "--ignore-scripts" not in install_body

postinstall = manifest["scripts"]["postinstall"]
assert "scripts/generate-data.ts" in postinstall
assert "pnpm build" in postinstall
assert "fetchTemplates" in generator
assert "process.env.GITHUB_TOKEN" in templates
assert "authorization: `token ${process.env.GITHUB_TOKEN}`" in templates

safe_sequence = [
    "pnpm install --frozen-lockfile --ignore-scripts",
    "node --experimental-strip-types ./scripts/generate-data.ts",
    "pnpm build",
]
assert all(command in postinstall or command in safe_sequence for command in safe_sequence)

print("pack install passes GITHUB_TOKEN to pnpm without --ignore-scripts")
print("root postinstall runs generator and build")
print("generator reaches token-backed GitHub API requests")
print("safe split requires install --ignore-scripts, generator, then build")
PY

Repository: nuxt/cli

Length of output: 373


Do not expose GITHUB_TOKEN during dependency installation.

Run pnpm install --frozen-lockfile --ignore-scripts, then run generate-data.ts with the token in a separate step, followed by pnpm build without the token. The current postinstall runs both commands. The install-scoped token is inherited by allowed dependency lifecycle scripts. permissions: {} does not prevent token exfiltration.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml around lines 79 - 80, Update the release
workflow so the install step runs pnpm install --frozen-lockfile
--ignore-scripts without GITHUB_TOKEN, then invoke generate-data.ts in a
separate token-scoped step, and run pnpm build in a step without the token.
Remove or bypass the current postinstall flow that combines generation and
building during dependency installation, while preserving the required command
order.

@danielroe
danielroe added this pull request to the merge queue Aug 12, 2026
Merged via the queue into main with commit 0bb4e52 Aug 12, 2026
19 checks passed
@danielroe
danielroe deleted the chore/templates branch August 12, 2026 13:19
@github-actions github-actions Bot mentioned this pull request Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant