Lighthouse #1704
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
name: Lighthouse | |
on: | |
deployment_status: | |
jobs: | |
lighthouse-run-preview-desktop: | |
name: Desktop Audit (Preview) | |
if: github.event.deployment_status.state == 'success' && github.event.deployment_status.environment == 'Preview' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run Lighthouse | |
uses: ./.github/actions/run-lighthouse | |
id: lighthouse | |
with: | |
profile: desktop | |
- name: Add Lighthouse stats as comment | |
if: always() | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message-id: lighthouse-desktop | |
message-failure: | | |
### ❌ Unable to get lighthouse scores | |
message: ${{ steps.lighthouse.outputs.comment }} | |
lighthouse-run-preview-mobile: | |
name: Mobile Audit (Preview) | |
if: github.event.deployment_status.state == 'success' && github.event.deployment_status.environment == 'Preview' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run Lighthouse | |
uses: ./.github/actions/run-lighthouse | |
id: lighthouse | |
with: | |
profile: mobile | |
- name: Add Lighthouse stats as comment | |
if: always() | |
uses: mshick/add-pr-comment@v2 | |
with: | |
message-id: lighthouse-mobile | |
message-failure: | | |
### ❌ Unable to get lighthouse scores | |
message: ${{ steps.lighthouse.outputs.comment }} | |
lighthouse-run-production-desktop: | |
name: Desktop Audit (Production) | |
if: github.event.deployment_status.state == 'success' && github.event.deployment_status.environment == 'Production' | |
runs-on: ubuntu-latest | |
env: | |
LIGHTHOUSE_BRANCH: 'main' | |
LIGHTHOUSE_FILE: 'README.md' | |
LIGHTHOUSE_BEGIN_TOKEN: '<!-- LIGHTHOUSE:BEGIN -->' | |
LIGHTHOUSE_END_TOKEN: '<!-- LIGHTHOUSE:END -->' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# Required due to branch protection rules - must be a repo admin | |
token: ${{ secrets.PROTECTED_PUSH_TOKEN }} | |
ref: ${{ env.LIGHTHOUSE_BRANCH }} | |
- name: Run Lighthouse | |
uses: ./.github/actions/run-lighthouse | |
id: lighthouse | |
with: | |
profile: desktop | |
- name: Add Lighthouse to README.md | |
if: always() | |
run: | | |
begin=$LIGHTHOUSE_BEGIN_TOKEN | |
end=$LIGHTHOUSE_END_TOKEN | |
file=$LIGHTHOUSE_FILE | |
data="${{ steps.lighthouse.outputs.comment }}" | |
awk -i inplace \ | |
-v begin="$begin" \ | |
-v end="$end" \ | |
-v data="$data" '$0~end{f=0} !f{print} $0~begin{print data;f=1}' \ | |
"$file" | |
- name: Commit to repo | |
if: always() | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.PROTECTED_PUSH_TOKEN }} | |
with: | |
commit_message: Lighthouse Score [skip ci] | |
skip_dirty_check: true | |
file_pattern: README.md | |
commit_user_name: lighthouse-action | |
commit_user_email: [email protected] | |
commit_author: lighthouse-action <[email protected]> | |
lighthouse-run-production-mobile: | |
name: Mobile Audit (Production) | |
if: github.event.deployment_status.state == 'success' && github.event.deployment_status.environment == 'Production' | |
runs-on: ubuntu-latest | |
env: | |
LIGHTHOUSE_BRANCH: 'main' | |
LIGHTHOUSE_FILE: 'README.md' | |
LIGHTHOUSE_BEGIN_TOKEN: '<!-- LIGHTHOUSE:BEGIN -->' | |
LIGHTHOUSE_END_TOKEN: '<!-- LIGHTHOUSE:END -->' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# Required due to branch protection rules - must be a repo admin | |
token: ${{ secrets.PROTECTED_PUSH_TOKEN }} | |
ref: ${{ env.LIGHTHOUSE_BRANCH }} | |
- name: Run Lighthouse | |
uses: ./.github/actions/run-lighthouse | |
id: lighthouse | |
with: | |
profile: mobile | |
- name: Add Lighthouse to README.md | |
if: always() | |
run: | | |
begin=$LIGHTHOUSE_BEGIN_TOKEN | |
end=$LIGHTHOUSE_END_TOKEN | |
file=$LIGHTHOUSE_FILE | |
data="${{ steps.lighthouse.outputs.comment }}" | |
awk -i inplace \ | |
-v begin="$begin" \ | |
-v end="$end" \ | |
-v data="$data" '$0~end{f=0} !f{print} $0~begin{print data;f=1}' \ | |
"$file" | |
- name: Commit to repo | |
if: always() | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.PROTECTED_PUSH_TOKEN }} | |
with: | |
commit_message: Lighthouse Score [skip ci] | |
skip_dirty_check: true | |
file_pattern: README.md | |
commit_user_name: lighthouse-action | |
commit_user_email: [email protected] | |
commit_author: lighthouse-action <[email protected]> |