treosh / lighthouse-ci-action

Audit URLs using Lighthouse and test performance with Lighthouse CI.
MIT License
1.18k stars 83 forks source link

[BUG] budget.json not found in assertion sub-step #72

Closed pixelmord closed 3 years ago

pixelmord commented 4 years ago

The action does for some reason use an incorrect path to budget.json. The repo-name in the path is duplicated like so: /home/runner/work/%REPO%/%REPO%/budget.json

Also happens in your demo here: https://github.com/denar90/lightouse-ci-netlify-preact/runs/891728484?check_suite_focus=true

Asserting
  Error: ENOENT: no such file or directory, open '/home/runner/work/lightouse-ci-netlify-preact/lightouse-ci-netlify-preact/budget.json'
      at Object.openSync (fs.js:440:3)
      at Object.readFileSync (fs.js:342:35)
      at readBudgets (/home/runner/work/_actions/treosh/lighthouse-ci-action/v3/node_modules/@lhci/cli/src/assert/assert.js:41:24)
      at Object.runCommand (/home/runner/work/_actions/treosh/lighthouse-ci-action/v3/node_modules/@lhci/cli/src/assert/assert.js:54:57)
      at run (/home/runner/work/_actions/treosh/lighthouse-ci-action/v3/node_modules/@lhci/cli/src/cli.js:88:23)
      at Object.<anonymous> (/home/runner/work/_actions/treosh/lighthouse-ci-action/v3/node_modules/@lhci/cli/src/cli.js:119:1)
      at Module._compile (internal/modules/cjs/loader.js:959:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
      at Module.load (internal/modules/cjs/loader.js:815:32)
alekseykulikov commented 3 years ago

It is a working budget.json example: https://github.com/treosh/lighthouse-ci-action/actions?query=workflow%3ALHCI-assert-on-budget Is it possible that there's an edge case that we need to document or handle?

mattstein commented 1 year ago

I was stuck on this until I realized I forgot to include a actions/checkout step.

The duplicated repo name in the path is accurate—there isn’t a budget.json to read if it was never checked out. 🤦‍♂️