treosh / lighthouse-ci-action

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

Document how to set LHCI's GitHub Status check #60

Open kaihendry opened 4 years ago

kaihendry commented 4 years ago

Digging into the output, it would appear No GitHub token set, skipping GitHub status check. ?

https://github.com/kaihendry/ltabus/runs/748414075

Which doesn't make sense to me, as shouldn't it be set automatically?

https://github.com/kaihendry/ltabus/blob/master/.github/workflows/main.yml

shawnbot commented 3 years ago

@kaihendry I came across this issue and hunted down a fix. Lighthouse CI respects the LHCI_GITHUB_TOKEN environment variable, so if you have a secret of the same name you can add it with:

# https://github.com/marketplace/actions/lighthouse-ci-action
name: Lighthouse Audit
on: push
jobs:
  lighthouse:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Audit URLs using Lighthouse
        uses: treosh/lighthouse-ci-action@v3
+       env:
+         LHCI_GITHUB_TOKEN: ${{ secrets.LHCI_GITHUB_TOKEN }}
chrisreddington commented 3 years ago

What is the GitHub token used for? The readme doesn't seem to talk much about a GitHub token needed. So, given we need to assign a PAT - what's the least amount of permissions needed for this to complete successfully? Would be great to document this in the readme 👍

chrisreddington commented 3 years ago

From what I can see, it would be the repo:status scope? According to the Lighthouse CI docs - https://github.com/GoogleChrome/lighthouse-ci/blob/master/docs/getting-started.md#alternative-personal-access-token-method

Stanzilla commented 3 years ago

Yeah this would be nice to have in the docs