Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to combine staticDistDir and urls #123

Open
shadovo opened this issue Mar 26, 2023 · 0 comments
Open

Possibility to combine staticDistDir and urls #123

shadovo opened this issue Mar 26, 2023 · 0 comments

Comments

@shadovo
Copy link

shadovo commented Mar 26, 2023

Hello! I am trying to use both staticDistDir and urls in the Lighthouse CI Action, but I am having trouble getting them to work together. I would like to use staticDistDir to specify the directory where my static pages are located, and urls to specify a list of specific pages to test. This would allow me to only run Lighthouse on the pages that have changed and speed up my PR builds.

However, I am unsure how to configure the action to use both staticDistDir and urls. Here is an example of the action I am using:

name: Lighthouse
on:
  pull_request:
    branches: ['main']
jobs:
  static-dist-dir:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Run Lighthouse against a static dist dir
        uses: treosh/lighthouse-ci-action@v9
        with:
          configPath: './lighthouserc.json'
          urls: |
            ${{ list of changed URLs generated by other action }}
          # example of a url: http://localhost/my-changed-page/index.html

And here is my lighthouserc.json file:

{
  "ci": {
    "collect": {
      "staticDistDir": "./build"
    }
  },
  // additional lighthouse assert settings
}

I do get the correct list of changed URLs as input when I look at the build log under Action config > Input args > urls.

I believe that changing line 31 in the index.js file from else if to if would allow me to use both staticDistDir and urls. However, I am not certain if this would work based on the comment on the line below. Could someone please advise me on how to use both staticDistDir and urls together?

Thank you for your help!

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

No branches or pull requests

1 participant