Skip to content

LazerTechnologies/lighthouse-ci-action

 
 

Repository files navigation

lazertechnologies/lighthouse-ci-action

About this repo | Usage | Authentication | Configuration

About this repo

Lighthouse CI on Shopify Theme Pull Requests using GitHub Actions.

Usage

Add lazertechnologies/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: lazertechnologies/lighthouse-ci-action@v1.2.3
        with:
          store: ${{ secrets.SHOP_STORE }}
          password: ${{ secrets.SHOP_PASSWORD }}
          app_client_id: ${{ secrets.APP_CLIENT_ID }}
          app_secret: ${{ secrets.APP_SECRET }}
          lhci_github_app_token: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
          lhci_min_score_performance: 0.6
          lhci_min_score_accessibility: 0.9

Authentication

Authentication is done with Client credentials grant.

  1. Create the app on your dev dashboard.
  2. Enable the following Admin API scopes:
    • read_products
    • write_themes
  3. Install the app on the development store created for Lighthouse testing.
  4. Take note of the Client ID and Secret.
  5. Add the following to your repository's GitHub Secrets:
    • SHOP_STORE: Shopify store <store>.myshopify.com URL
    • APP_CLIENT_ID: the client ID for your private app
    • APP_SECRET: the secret for your private app

Configuration

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

  • app_client_id - (required) see Authentication
  • app_secret - (required) see Authentication
  • store - (required) Shopify store Admin URL, e.g. my-store.myshopify.com.
  • password - (optional) For password protected shops
  • product_handle - (optional) Product handle to run the product page Lighthouse run on. Defaults to the first product.
  • theme_root - (optional) The root folder for the theme files that will be uploaded. Defaults to .
  • collection_handle - (optional) Collection handle to run the product page Lighthouse run on. Defaults to the first collection.
  • pull_theme - (optional) The ID or name of a theme from which the settings and JSON templates should be used. If not provided Lighthouse will be run against the theme's default settings.
  • lhci_min_score_performance - (optional, default: 0.6) Minimum performance score for a passed audit (must be between 0 and 1).
  • lhci_min_score_accessibility - (optional, default: 0.9) Minimum accessibility score for a passed audit

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

  • lhci_github_app_token - (optional) Lighthouse GitHub app token
  • lhci_github_token - (optional) GitHub personal access token

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

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Shell 92.0%
  • Makefile 6.2%
  • Dockerfile 1.8%