treosh / lighthouse-ci-action

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

dynamic urls list #95

Closed bennypowers closed 2 years ago

bennypowers commented 2 years ago

Say I want to send the list of urls in a webhook, or calculate it based on some state in my repo, or define it using a javascript function.

It would be great to be able to dynamically build the list of urls.

Cheers

davidsneighbour commented 2 years ago

I am working on the same issue. In my opinion it is possible to create this by for instance having a json file with URLs that prepares an array in a job that runs before the lighthouse job and then using it's output in the lighthouse job.

Documentation about this is here: https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs, now on to find an action that loads json into a variable :)

bennypowers commented 2 years ago

I am working on the same issue. In my opinion it is possible to create this by for instance having a json file with URLs that prepares an array in a job that runs before the lighthouse job and then using it's output in the lighthouse job.

Documentation about this is here: https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs, now on to find an action that loads json into a variable :)

that's exactly what i ended up doing

https://github.com/patternfly/patternfly-elements/blob/9035f4e4d32fee407cbf49740ce2fca9aec9e2fc/.github/workflows/visual-regression.yml#L50-L75

davidsneighbour commented 2 years ago

perfect. that is worth a mention in the sample workflows section. @alekseykulikov

alekseykulikov commented 2 years ago

I'd love to add it as a recipe: https://github.com/treosh/lighthouse-ci-action#recipes Don't you mind making a PR to docs?