Search code examples
reactjsgithubgithub-actionslighthouselighthouse-ci

Lighthouse is not writing any files


I'm trying to generate lighthouse report using cli. I'm using this command locally:

lhci autorun

And this is working absolutely fine. It is generating reports as it should. light house generates the report locally

Then I'm trying to use GitHub actions to generate the report, it generates the report as we can see on the next snap here: lighthouse says it is working fine in github actions

But I couldn't find any trace of that directory. Please take a look at the next snap: no trace of lighthouse directory in github actions

What am I doing wrong?

This is a react + vite based project, with typescript, if this information is helpful.

Here are the details of the action:

I'm using @lhci/[email protected] and installing it like npm i -g @lhci/[email protected].


Solution

  • According to the Breaking Changes of actions/upload-artifact:

    With v4.4 and later, hidden files are excluded by default.

    And, the Uploading Hidden Files section mentions the reason:

    By default, hidden files are ignored by this action to avoid unintentionally uploading sensitive information.

    The file .lighthouseci starts with a dot . and is considered a hidden file that's why it's excluded.

    You'll have to set include-hidden-files input parameter to upload it:

    include-hidden-files: true
    

    This breaking change was also announced in this GitHub Changelog entry published on August 19, 2024:

    Exclude hidden files by default in Upload Artifact GitHub Actions

    From September 2nd, 2024, we will no longer include hidden files and folders as part of the default upload of the v3 and v4 upload-artifact actions. This reduces the risk that credentials are accidentally uploaded into artifacts. Customers who need to continue to upload these files can use a new option, ‘include-hidden-files’, to continue to do so.

    You might want to keep an eye on GitHub Changelog to get the latest.