-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
55 lines (47 loc) · 1.61 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: 'Lighthouse CI for Pull Requests'
description: 'Runs Lighthouse CI on a PR and posts the results as a comment'
inputs:
urls:
description: 'List of URL(s) to analyze'
required: true
lhConfigPath:
description: 'Config passed to Lighthouse CI action'
required: true
runs:
using: 'composite'
steps:
- run: |
sudo apt-get update
sudo apt-get install -y libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev libasound2
shell: bash
- uses: browser-actions/setup-chrome@latest
- run: |
chrome --version
which chrome
shell: bash
- name: Audit preview URL with Lighthouse
id: lhci
uses: treosh/lighthouse-ci-action@v3
with:
configPath: ${{inputs.lhConfigPath}}
urls: ${{inputs.urls}}
- name: Checkout
uses: actions/checkout@v3
- name: Format lighthouse score
id: format_lhci_score
uses: actions/github-script@v6
with:
script: |
const generateCommentFromResults = require('${{ github.action_path }}/scripts/generateCommentFromResults.js')
const results = ${{ steps.lhci.outputs.manifest }}
const comment = generateCommentFromResults({results})
core.setOutput('comment', comment)
- name: Add comment to PR
id: comment_to_pr
uses: marocchino/sticky-pull-request-comment@v2
with:
hide_and_recreate: true
hide_classify: 'OUTDATED'
number: ${{ github.event.issue.number }}
message: |
${{ steps.format_lhci_score.outputs.comment }}