refactor: lighthouse.yml file #7
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 CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
lighthouse: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Set up Node.js environment | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
# Install dependencies | |
- name: Install dependencies | |
run: npm install | |
# Create lhci-report folder to store the Lighthouse report | |
- name: Create lhci-report folder | |
run: mkdir -p lhci-report | |
# Run Lighthouse CI to generate the report | |
- name: Run Lighthouse CI | |
# run: npx lighthouse --output-path=lhci-report/report.json | |
run: npx lighthouse https://thirtysixstudiooclone.vercel.app --output json --output-path=lhci-report/report.json | |
# Check if the report is generated | |
- name: Check report | |
run: ls -la ./lhci-report/report.json | |
# Update README with Lighthouse scores | |
- name: Update README with Lighthouse scores | |
run: node update-readme.js | |
# Commit and push the updated README | |
- name: Commit updated README | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add README.md | |
git commit -m "Update Lighthouse scores" | |
git push |