> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# foo-software/lighthouse-check

A CircleCI Orb for running Lighthouse audits with all the bells and whistles 🔔 Multiple audits, Slack notifications and more!

## Commands

### audit

Run a Lighthouse audit and save results

| Parameter | Type | Default | Description |
|---|---|---|---|
| `apiToken` | string |  | The foo.software account API token found in the dashboard. |
| `author` | string | $CIRCLE_USERNAME | For Slack notifications - A user handle, typically from GitHub. |
| `awsAccessKeyId` | string | $LIGHTHOUSE_CHECK_AWS_ACCESS_KEY_ID | The AWS accessKeyId for an S3 bucket for optional HTML report upload. |
| `awsBucket` | string | $LIGHTHOUSE_CHECK_AWS_BUCKET | The AWS Bucket for an S3 bucket for optional HTML report upload. |
| `awsRegion` | string | $LIGHTHOUSE_CHECK_AWS_REGION | The AWS region for an S3 bucket for optional HTML report upload. |
| `awsSecretAccessKey` | string | $LIGHTHOUSE_CHECK_AWS_SECRET_ACCESS_KEY | The AWS secretAccessKey for an S3 bucket for optional HTML report upload. |
| `branch` | string | $CIRCLE_BRANCH | For Slack notifications - A version control branch, typically from GitHub. |
| `configFile` | string |  | A configuration file path in JSON format which holds all options defined here. This file should be relative to the file being interpretted. In this case it will most likely be the root of the repo ("./") |
| `emulatedFormFactor` | string |  | Lighthouse setting only used for local audits. See lighthouse-check NPM module for details. |
| `extraHeaders` | string |  | Stringified HTTP Header object key/value pairs to send in requests. |
| `locale` | string |  | A locale for Lighthouse reports. Example - ja |
| `maxWaitForLoad` | integer | 45000 | The maximum amount of time to wait for a page to load in ms |
| `overridesJsonFile` | string |  | A JSON file with config and option fields to overrides defaults. |
| `pr` | string | $CIRCLE_PULL_REQUEST | For Slack notifications - A version control pull request URL, typically from GitHub. |
| `prCommentAccessToken` | string |  | Access token of a user to post PR comments. |
| `prCommentEnabled` | boolean | true | If true and accessToken is set scores will be posted as comments. |
| `prCommentSaveOld` | boolean | false | If true and PR comment options are set, new comments will be posted on every change vs only updating once comment with most recent scores. |
| `prCommentUrl` | string |  | An endpoint to post comments to. Typically this will from GitHub's API. Example: https://api.github.com/repos/:owner/:repo/pulls/:pull_number/reviews |
| `sha` | string | $CIRCLE_SHA1 | For Slack notifications - A version control sha, typically from GitHub. |
| `slackWebhookUrl` | string | $LIGHTHOUSE_CHECK_SLACK_WEBHOOK_URL | A Slack Incoming Webhook URL to send notifications to. |
| `tag` | string |  | An optional tag or name (example: "build #2" or "v0.0.2"). |
| `throttling` | string |  | Lighthouse setting only used for local audits. See lighthouse-check NPM module comments for details. |
| `throttlingMethod` | string |  | Lighthouse setting only used for local audits. See lighthouse-check NPM module comments for details. |
| `timeout` | integer | 10 | Minutes to timeout for remote runs. If "wait" option is "true" (it is by default), we wait for results. If this timeout is met before results are received an error is thrown. |
| `urls` | string |  | A comma-separated list of URLs (or page API tokens if running remotely). |
| `wait` | boolean | true | If "true", for remote runs, waits for all audit results to be returned, otherwise URLs are only enqueued. |

### validate-status

Validate results of Lighthouse audits from minimum score requirements. Fail the job if requirements aren't met.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `minAccessibilityScore` | string |  | The minimum accessibility Lighthouse score required. |
| `minBestPracticesScore` | string |  | The minimum best practices Lighthouse score required. |
| `minPerformanceScore` | string |  | The minimum performance Lighthouse score required. |
| `minProgressiveWebAppScore` | string |  | The minimum progressive web app Lighthouse score required. |
| `minSeoScore` | string |  | The minimum SEO Lighthouse score required. |

## Executors

### default

## Examples

### advanced

Run a Lighthouse audit with advanced settings.

```yaml
jobs:
  test:
    executor: lighthouse-check/default
    steps:
      - lighthouse-check/audit:
          awsAccessKeyId: $LIGHTHOUSE_CHECK_AWS_ACCESS_KEY_ID
          awsBucket: $LIGHTHOUSE_CHECK_AWS_BUCKET
          awsRegion: $LIGHTHOUSE_CHECK_AWS_REGION
          awsSecretAccessKey: $LIGHTHOUSE_CHECK_AWS_SECRET_ACCESS_KEY
          slackWebhookUrl: $LIGHTHOUSE_CHECK_SLACK_WEBHOOK_URL
          urls: https://www.foo.software,https://www.foo.software/contact
      - lighthouse-check/validate-status:
          minAccessibilityScore: '50'
          minBestPracticesScore: '50'
          minPerformanceScore: '99'
          minProgressiveWebAppScore: '50'
          minSeoScore: '50'
orbs:
  lighthouse-check: foo-software/lighthouse-check@0.0.8
version: 2.1
workflows:
  test:
    jobs:
      - test
```

### automated-lighthouse-check

Run a Lighthouse audits from foo.software.

```yaml
jobs:
  test:
    executor: lighthouse-check/default
    steps:
      - lighthouse-check/audit:
          apiToken: $LIGHTHOUSE_CHECK_API_TOKEN
          urls: mypagetoken1,mypagetoken2
orbs:
  lighthouse-check: foo-software/lighthouse-check@0.0.8
version: 2.1
workflows:
  test:
    jobs:
      - test
```

### automated-lighthouse-check-with-pr-comment

Run a Lighthouse audits from foo.software and posts results as PR comments.

```yaml
jobs:
  test:
    executor: lighthouse-check/default
    steps:
      - lighthouse-check/audit:
          apiToken: $LIGHTHOUSE_CHECK_API_TOKEN
          prCommentAccessToken: $LIGHTHOUSE_CHECK_ACCESS_TOKEN
          prCommentUrl: >-
            https://api.github.com/repos/foo-software/lighthouse-check-orb/pulls/${CIRCLE_PULL_REQUEST##*/}/reviews
          urls: mypagetoken1,mypagetoken2
orbs:
  lighthouse-check: foo-software/lighthouse-check@0.0.8
version: 2.1
workflows:
  test:
    jobs:
      - test
```

### extra-headers

Run a simple Lighthouse audit with extra headers.

```yaml
jobs:
  test:
    executor: lighthouse-check/default
    steps:
      - lighthouse-check/audit:
          extraHeaders: '{ "x-hello-world": "foobar", "x-some-other-thing": "hi" }'
          urls: https://lighthouse-check-action.now.sh/
orbs:
  lighthouse-check: foo-software/lighthouse-check@0.0.13
version: 2.1
workflows:
  test:
    jobs:
      - test
```

### simple

Run a simple Lighthouse audit.

```yaml
jobs:
  test:
    executor: lighthouse-check/default
    steps:
      - lighthouse-check/audit:
          urls: https://www.foo.software,https://www.foo.software/contact
orbs:
  lighthouse-check: foo-software/lighthouse-check@0.0.6
version: 2.1
workflows:
  test:
    jobs:
      - test
```