Home

Awesome

Lighthouse CI Compare Action

GitHub Super-Linter CI Check dist/ CodeQL Coverage

This action helps you to based on the results of running Lighthouse CI, compare the current results with the ancestor commit results.

This comparison can be used to create a Markdown table and a comment on the pull request.

Getting started

Prerequisites

Usage

- name: Lighthouse CI Compare
  uses: adevinta/actions-lighthouseci-compare@v1
  with:
    links-filepath: '.lighthouseci/links.json'
    base-url: 'https://your-lhci-server.com/v1'
    project-id: 'your-project-id'
    current-commit-sha:
      ${{ github.event_name == 'pull_request' &&
      github.event.pull_request.head.sha || github.sha }}
    should-build-fail: true

current-commit-sha: If you are in a Pull Request, you need the github.event.pull_request.head.sha to compare with the commit from which your branch came from, otherwise you can use github.sha.

Inputs

links-filepath

base-url

project-id

current-commit-sha

should-fail-build

Outputs

markdown

This is a Markdown table with the results of the comparison.

The table looks like this:

<!-- markdownlint-disable -->
URLPerformanceLCPCLSTBTLink to Report
/72/100 🟢1338 ms 🔴0.059 🟢1747 ms 🟢Report
/maison_jardin/offres68/100 🔴2045 ms 🔴0.048 🟢2518 ms 🔴Report
/classified/latest/1273/100 🔴1181 ms 🔴0.002 🟢1803 ms 🔴Report
<!-- markdownlint-enable -->

comparedMetrics

This is the object used to create the table. You can use this output to create your own results or programmatically in a different script.

The object looks like the following:

{
  /classified/latest/12:
   { performance:{currentValue:73,previousValue:75,diff:-2,isRegression:true},
     lcp:{currentValue:1181,previousValue:1061,diff:120,isRegression:true},
     cls:{currentValue:0.002,previousValue:0.002,diff:0,isRegression:false},
     tbt:{currentValue:1803,previousValue:1456,diff:347,isRegression:true}},
  /_maison_jardin_/offres:
    { performance:{currentValue:68,previousValue:71,diff:-3,isRegression:true},
      lcp:{currentValue:2045,previousValue:1513,diff:532,isRegression:true},
      cls:{currentValue:0.048,previousValue:0.048,diff:0,isRegression:false},
      tbt:{currentValue:2518,previousValue:2260,diff:258,isRegression:true}},
  /:
    { performance:{currentValue:72,previousValue:72,diff:0,isRegression:false},
      lcp:{currentValue:1338,previousValue:1228,diff:110,isRegression:true},
      cls:{currentValue:0.059,previousValue:0.059,diff:0,isRegression:false},
      tbt:{currentValue:1747,previousValue:1789,diff:-42,isRegression:false}}}

Which includes the URL as the key and the metrics as the value.

status

Tells if the action has failed or not. We are handling this output because there are reasons why this could fail and you might not want to continue the build anyway.

You can also use the directive continue-on-error in your workflow to continue even if this fails, but with this we provide you a way to know if the action has failed too.

See the FAQ section for more information.

failureReason

This is the reason why the action has failed. Is a print of the error message.

FAQ

My build is failing, what can I do?

Known reasons for failure: