Skip to content

Fix Lighthouse example #10

@lunelson

Description

@lunelson

The Lighthouse example in the README could be improved:

  • the npm install and build steps are unnecessary (other than the global install of lchi/cli), since we are testing against Netlify
  • if using the Lighthouse CI Github App to get Github Status Checks fed back to the PR, the checkout step needs to get its ref from github.event.pull_request.head.sha and the final step needs to get the LHCI_GITHUB_APP_TOKEN from the repo's secrets and supply it to env.
name: Lighthouse
on: pull_request
jobs:
  netlify-deploy-preview:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          ref: ${{ github.event.pull_request.head.sha }}
      - name: Read .nvmrc version
        run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
        id: nvm
      - name: Set Node.js version
        uses: actions/setup-node@v1
        with:
          node-version: "${{ steps.nvm.outputs.NVMRC }}"
      - name: Wait for Netlify Preview
        uses: jakepartusch/[email protected]
        id: netlify
        with:
          site_name: 'your-netlify-site-name'
          max_timeout: 300
      - name: Lighthouse CI
        run: |
          npm install -g @lhci/cli
          lhci autorun --upload.target=temporary-public-storage --collect.url=${{ steps.netlify.outputs.url }} || echo "LHCI failed!"
        env:
          LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions