diff --git a/README.md b/README.md index d9c13f8..b9aa374 100644 --- a/README.md +++ b/README.md @@ -32,17 +32,11 @@ jobs: ## Authentication -Authentication is done with [Custom App access tokens](https://shopify.dev/apps/auth/admin-app-access-tokens). +Authentication is done with [Theme Access](https://apps.shopify.com/theme-access). -1. [Create the app](https://help.shopify.com/en/manual/apps/custom-apps#create-and-install-a-custom-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](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository): +1. Install it in your store +2. Generate the theme access token +4. Add the following to your repository's [GitHub Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository): - `SHOP_ACCESS_TOKEN`: the Admin API access token - `SHOP_STORE`: Shopify store `.myshopify.com` URL @@ -59,6 +53,7 @@ The `shopify/lighthouse-ci-action` accepts the following arguments: * `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 +* `delete_theme_after_result` – (optional, default: 0) Deletes the theme that was created after the process completes.(must be 0 or 1) For the GitHub Status Checks on PR. One of the two arguments is required: diff --git a/entrypoint.sh b/entrypoint.sh index 7c4b2a7..4729619 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -17,6 +17,7 @@ [[ -n "$INPUT_COLLECTION_HANDLE" ]] && export SHOP_COLLECTION_HANDLE="$INPUT_COLLECTION_HANDLE" [[ -n "$INPUT_THEME_ROOT" ]] && export THEME_ROOT="$INPUT_THEME_ROOT" [[ -n "$INPUT_PULL_THEME" ]] && export SHOP_PULL_THEME="$INPUT_PULL_THEME" +[[ -n "$INPUT_DELETE_THEME_AFTER_RESULT" ]] && export SHOP_DELETE_THEME_AFTER_RESULT="$INPUT_DELETE_THEME_AFTER_RESULT" # Authentication creds export SHOP_ACCESS_TOKEN="$INPUT_ACCESS_TOKEN" @@ -246,3 +247,6 @@ EOF step "Running Lighthouse CI" lhci autorun +if [ "$SHOP_DELETE_THEME_AFTER_RESULT" = "1" ]; then + shopify theme delete --theme ${preview_id} -f +fi \ No newline at end of file