Skip to content

Commit c632539

Browse files
committed
chore(other): CHECKOUT-9275 Add Github action to run Lighthouse on every release
1 parent eacf7a6 commit c632539

File tree

7 files changed

+812
-6
lines changed

7 files changed

+812
-6
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Lighthouse audit
2+
3+
on: push
4+
#push:
5+
# branches:
6+
# - master
7+
8+
env:
9+
STORE_URL: ${{ vars.STORE_URL }}
10+
11+
jobs:
12+
#wait-for-circleci:
13+
# runs-on: ubuntu-latest
14+
# steps:
15+
# - name: Wait for CircleCI jobs to complete
16+
# uses: lewagon/wait-on-check-action@v1.3.4
17+
# with:
18+
# ref: ${{ github.sha }}
19+
# check-name: 'ci/circleci: release'
20+
# repo-token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
lighthouse-audit:
23+
#needs: wait-for-circleci
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Check out code
27+
uses: actions/checkout@v4
28+
29+
- name: Set up Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: 22
33+
34+
- name: Install dependencies
35+
run: npm ci
36+
37+
- name: Get PR details
38+
uses: jwalton/gh-find-current-pr@v1
39+
id: pr_details
40+
41+
- name: Run Lighthouse audit
42+
id: lighthouse_audit
43+
uses: treosh/lighthouse-ci-action@v11
44+
with:
45+
urls: ${{ env.STORE_URL }}/checkout
46+
configPath: ./scripts/lighthouse/lighthouserc.js
47+
uploadArtifacts: true
48+
temporaryPublicStorage: true
49+
runs: 1
50+
51+
- name: Format Lighthouse results
52+
id: format_lighthouse_results
53+
uses: actions/github-script@v7
54+
with:
55+
script: |
56+
const formatResults = require('./scripts/lighthouse/format-results.js');
57+
const comment = formatResults({
58+
manifest: ${{ steps.lighthouse_audit.outputs.manifest }},
59+
links: ${{ steps.lighthouse_audit.outputs.links }},
60+
});
61+
62+
core.setOutput("comment", comment);
63+
64+
- name: Post Lighthouse results to PR
65+
uses: marocchino/sticky-pull-request-comment@v2
66+
with:
67+
header: Lighthouse audit results
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
recreate: true
70+
number: ${{ steps.pr_details.outputs.number }}
71+
message: ${{ steps.format_lighthouse_results.outputs.comment }}
72+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.env
12
.idea
23
.vscode
34
.DS_Store

0 commit comments

Comments
 (0)