-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0235841
commit bb345d1
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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://freecodecamp.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://freecodecamp.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 | ||
}); |