cloudflare / cloudflare/wrangler-action

Confusing output when the root isn't an npm project, leaves a mess.

Open
#286 1 comment 0 reactions 0 assignees View on GitHub
enhancement triaged
Dominant language
TypeScript
Stars
1.9k
Forks
214
PR merge metrics
No merged PRs in 30d

Description

Hi. I'm using this action to upload a project that's not at root an npm project. The output is kind of confusing, and leaves a mess of the workspace.

```
/usr/local/bin/npx --no-install wrangler --version
npm error npx canceled due to missing packages and no YES option: ["wrangler@3.72.3"]
npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2024-08-28T17_12_25_179Z-debug-0.log
⚠️ Wrangler not found or version is incompatible. Installing...
📥 Installing Wrangler
/usr/local/bin/npm i wrangler@3.13.2
```

okay. Why did you do `npm i` instead of just `npx wrangler@3.13.2` ? Doesn't make sense.

Then when it goes to run:

```
/usr/local/bin/npx wrangler pages deploy ./_site --project-name=cldr
▲ [WARNING] Warning: Your working directory is a git repo and has uncommitted changes
To silence this warning, pass in --commit-dirty=true
```

Well, yeah, you dirtied it, wrangler :)

```
Run git status
HEAD detached at pull/3989/merge
Untracked files:
(use "git add ..." to include in what will be committed)
node_modules/
package-lock.json
package.json
```

So wrangler-action has added a node_modules, package.json and package-lock.json in my work area. And then complains that my work area is a mess.

I'm going to try a preemptive `npm i -g wrangler@3.x` to see if it cleans things up.

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Reproduce the action with a project that is not an npm project at the repository root, then inspect the Wrangler version check and installation commands shown in the report. Done means deployment no longer creates node_modules, package.json, or package-lock.json in the workspace and does not report those changes as user modifications.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, node.js, typescript
Domain
ci-cd, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.