Files
redwoodjs__local-ci/.github/workflows/smoke-node-setup.yml
Peter Pistorius e482875a95 fix: setup-node "Bad credentials" + stale-toolcache hint (#252)
* fix: setup-node "Bad credentials" + stale-toolcache hint (#171, #249)

Route setup-node's versions-manifest fetch through the DTU so it no
longer 401s against real api.github.com, and surface an actionable
hint when a stale /opt/hostedtoolcache bind mount blocks tar extract.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test: unit + smoke coverage for setup-node manifest mock

Adds unit tests for rewriteSetupNodeTarball and for the cached tree/blob
route paths, plus a nested-agent-ci smoke workflow that fails if
setup-node logs "Bad credentials" (the symptom of the manifest mock
breaking and falling back to nodejs.org).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 10:46:11 +02:00

84 lines
2.9 KiB
YAML

name: "Smoke: actions/setup-node manifest fetch"
# Reproduces #249 — actions/setup-node@v5 printed "Bad credentials" and fell
# back to downloading Node directly from nodejs.org because @actions/tool-cache
# hardcodes https://api.github.com and escapes our DTU. This smoke creates a
# throwaway project, runs agent-ci against a workflow that uses setup-node,
# and fails if the step logs the fallback path.
on:
pull_request_target:
types: [opened, labeled, synchronize]
jobs:
node-setup:
if: '!github.event.pull_request.draft && (contains(fromJSON(''["MEMBER", "OWNER", "COLLABORATOR"]''), github.event.pull_request.author_association) || contains(github.event.pull_request.labels.*.name, ''safe-to-run''))'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.30.1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- run: pnpm install
- name: Build agent-ci
run: pnpm --filter @redwoodjs/agent-ci... -r build
- name: Create temp node-setup project
run: |
mkdir -p /tmp/node-setup-repro/.github/workflows
cat > /tmp/node-setup-repro/package.json << 'PKG'
{ "name": "node-setup-repro", "private": true }
PKG
cat > /tmp/node-setup-repro/.github/workflows/test.yml << 'WF'
name: Test
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v5
with:
node-version: 24
package-manager-cache: false
- name: Verify node
run: |
node --version
corepack --version
WF
cd /tmp/node-setup-repro
git init
git remote add origin https://github.com/test-org/node-setup-repro.git
git add -A
git -c user.name="test" -c user.email="test@test.com" commit -m "init"
- name: Run agent-ci against node-setup project
id: run
working-directory: /tmp/node-setup-repro
run: |
node "$GITHUB_WORKSPACE/packages/cli/dist/cli.js" \
run --workflow .github/workflows/test.yml --quiet 2>&1 | tee /tmp/node-setup.out
- name: Assert setup-node took the manifest path (no "Bad credentials")
run: |
if grep -q "Bad credentials" /tmp/node-setup.out; then
echo "::error::setup-node fell back to the nodejs.org path — the DTU manifest mock is broken."
grep -n "Bad credentials\|Falling back\|Acquiring" /tmp/node-setup.out || true
exit 1
fi
echo "OK: no 'Bad credentials' in setup-node output."