Shopify / lighthouse-ci-action

MIT License
100 stars 50 forks source link

shopify/lighthouse-ci-action

About this repo | Usage | Authentication | Configuration

About this repo

Lighthouse CI on Shopify Theme Pull Requests using GitHub Actions.

Usage

Add shopify/lighthouse-ci-action to the workflow of your Shopify theme.

# .github/workflows/lighthouse-ci.yml
name: Shopify Lighthouse CI
on: [push]
jobs:
  lhci:
    name: Lighthouse
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Lighthouse
        uses: shopify/lighthouse-ci-action@v1
        with:
          store: ${{ secrets.SHOP_STORE }}
          access_token: ${{ secrets.SHOP_ACCESS_TOKEN }}
          lhci_github_app_token: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
          lhci_min_score_performance: 0.9
          lhci_min_score_accessibility: 0.9

Authentication

Authentication is done with Custom App access tokens.

  1. Create the app.
  2. Click the Configure Admin API Scopes button.
  3. Enable the following scopes:
    • read_products
    • write_themes
  4. Click Save.
  5. From the API credentials tab, install the app.
  6. Take note of the Admin API access token.
  7. Add the following to your repository's GitHub Secrets:
    • SHOP_ACCESS_TOKEN: the Admin API access token
    • SHOP_STORE: Shopify store <store>.myshopify.com URL

Configuration

The shopify/lighthouse-ci-action accepts the following arguments:

For the GitHub Status Checks on PR. One of the two arguments is required:

For more details on the implications of choosing one over the other, refer to the Lighthouse CI Getting Started Page