About this repo | Usage | Authentication | Configuration
Lighthouse CI on Shopify Theme Pull Requests using GitHub Actions.
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@v2
- 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 is done with Custom App access tokens.
- Create the app.
- Click the
Configure Admin API Scopes
button. - Enable the following scopes:
read_products
write_themes
- Click
Save
. - From the
API credentials
tab, install the app. - Take note of the
Admin API access token
. - Add the following to your repository's GitHub Secrets:
SHOP_ACCESS_TOKEN
: the Admin API access tokenSHOP_STORE
: Shopify store<store>.myshopify.com
URL
The shopify/lighthouse-ci-action
accepts the following arguments:
access_token
- (required) see Authenticationstore
- (required) Shopify store<domain>.myshopify.com
URL.password
- (optional) For password protected shopsproduct_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.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 tokenlhci_github_token
- (optional) GitHub personal access token
For pushing report to customer Lighthouse CI Server:
lhci_server_base_url
- (optional) The base URL of the LHCI server to upload to.Required
when using lhci_target=lhci Configlhci_token
- (optional) (The build token for your Lighthouse CI project.Required
when using lhci_target=lhci) Configlhci_target
- (optional) The target location to which Lighthouse CI should upload the reports Config
For more details on the implications of choosing one over the other, refer to the Lighthouse CI Getting Started Page
The following were used to authenticate with private apps.
app_id
- (deprecated) Shopify store private app ID.app_password
- (deprecated) Shopify store private app password.