/lighthouse-viewer-action

View Lighthouse results in Command Line Interface.

Primary LanguageJavaScriptMIT LicenseMIT

Lighthouse Viewer Action

GitHub release GitHub last commit GitHub issues GitHub pull requests GitHub stars GitHub license

View Lighthouse results from Lighthouse CI Action in Command Line Interface.

This action is inspired by the issue of Lighthouse CI Action. Make it easier to view the reports from Lighthouse auditing in Command Line Interface. As a separate action, it can also display other reports that follow the same format of Lighthouse CI Action results.

screenshot

Table of Contents

Usage

Run this action after the Lighthouse CI Action, and specify the resultsPath as the input parameters. To display reports even when a assertion fails, set continue-on-error: true for Lighthouse CI Action and pass the lighthouseOutcome to raise errors after showing the reports.

name: Lighthouse Auditing

on: push

jobs:
  lighthouse:
    runs-on: ubuntu-latest
    name: Lighthouse-CI
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Audit with Lighthouse
        id: lighthouse
        continue-on-error: true
        uses: treosh/lighthouse-ci-action@v10
        with:
          urls: |
              https://example.com/
          configPath: './lighthouserc.json'
      - name: Display Report
        uses: jackywithawhitedog/lighthouse-viewer-action@v1
        with:
          resultsPath: ${{ steps.lighthouse.outputs.resultsPath }}
          lighthouseOutcome: ${{ steps.lighthouse.outcome }}

Input Parameters

resultsPath

Results path of Lighthouse CI Action. The action would take files that match the pattern <resultsPath>/lhr-*.json as the result files.

resultsPath: ${{ steps.<lighthouse_ci_step_id>.outputs.resultsPath }}

lighthouseOutcome

The outcome of Lighthouse CI Action. Set continue-on-error for Lighthouse CI Action and pass the outcome here to delay the assertion failure after displaying Lighthouse reports.

lighthouseOutcome: ${{ steps.<lighthouse_ci_step_id>.outcome }}