foo-software / lighthouse-check-action

GitHub Action for running @GoogleChromeLabs Lighthouse audits with all the bells and whistles 🔔 Multiple audits, Slack notifications, and more!
https://github.com/marketplace/actions/lighthouse-check
MIT License
479 stars 24 forks source link

urls options not working with automated-lighthouse-check #22

Closed gslama-akqa closed 4 years ago

gslama-akqa commented 4 years ago

First of all, thank you for this amazing product!

We're currently building a Github action that leverages lighthouse-check-action. It's working smoothly apart from one feature: getting Automated Lighthouse Check to work with Netlify Previews.

To do so, we logically have to specify a apiToken and a custom url :

urls: 'https://deploy-preview-${{ github.event.pull_request.number }}--.netlify.app'

Unfortunately, we're now stuck with this error: "All URLs failed to be enqueued". If we don't specify the urls override, it falls back on the url defined in Automated Lighthouse Check and then works well.

Am I missing something?

adamhenson commented 4 years ago

Hi @gslama-akqa - thanks for opening this. If I understand correctly, I believe we support this, but it's a bit obscure. The documentation for this project is becoming a bit overloaded and this part of the API is not very intuitive. I believe what you're looking for is this format {page token}::{custom url}. So, in your example you'd need something like the below.

urls: '${{ apiToken }}::https://deploy-preview-${{ github.event.pull_request.number }}--.netlify.app'

It's similar to the ZEIT Now example.

We have some work to do to make these features more intuitive as well as clear and concise documentation, but we'll get there.

Does that answer your question?

gslama-akqa commented 4 years ago

I can confirm it worked. Thanks a lot for the quick answer.

In case it can help, here is what my configuration for lighthouse-check-action now looks like:

- name: Run Lighthouse
  uses: foo-software/lighthouse-check-action@master
  with:
    extraHeaders: '{ "Authorization": "Basic ${{ secrets.BASIC_AUTH }}" }'
    accessToken: ${{ secrets.LIGHTHOUSE_CHECK_GITHUB_ACCESS_TOKEN }}
    apiToken: ${{ secrets.LIGHTHOUSE_CHECK_GITHUB_API_TOKEN }}
    author: ${{ github.actor }}
    branch: ${{ github.ref }}
    outputDirectory: /tmp/artifacts
    urls: '${{ secrets.LIGHTHOUSE_CHECK_GITHUB_PAGE_TOKEN }}::https://deploy-preview-${{ github.event.pull_request.number }}--${{ secrets.NETLIFY_SITE_NAME }}.netlify.app'
adamhenson commented 4 years ago

Great! You're welcome. You can also use a comma-separated list here as well. We'll probably change the way this is written in the future, but it will be backwards-compatible so this should always work.