-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (43 loc) · 1.61 KB
/
lighthouse.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
name: Lighthouse CI
on:
workflow_dispatch:
pull_request:
branches:
- "main"
jobs:
lighthouse:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Audit URLs using Lighthouse
id: lighthouse
uses: treosh/lighthouse-ci-action@v10
with:
urls: |
https://jpshop.jpdiaz.dev/
budgetPath: ./budget.json # test performance budgets
uploadArtifacts: true # save results as an action artifacts
temporaryPublicStorage: true # upload lighthouse report to the temporary storage
- name: Add comment with Lighthouse action URL
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const runId = context.runId;
const owner = context.repo.owner;
const repo = context.repo.repo;
const actionUrl = `https://github.com/${owner}/${repo}/actions/runs/${runId}`;
const commentBody = `
**Check the Lighthouse CI Report** 🚀
1. **Audit URL**:\`https://jpshop.jpdiaz.dev/\`
2. **Open the [Lighthouse CI action here](${actionUrl})**
3. **Check the Report**:
- Click on \`lighthouse\` > \`Audit URLs using Lighthouse\` > \`Uploading\` > \`open the report\` to see the full report.
`;
github.rest.issues.createComment({
owner: owner,
repo: repo,
issue_number: context.issue.number,
body: commentBody
});