Skip to content

Cron Lighthouse Report Generator #107

Cron Lighthouse Report Generator

Cron Lighthouse Report Generator #107

name: Cron Lighthouse Report Generator
on:
schedule:
- cron: '0 5 * * 1'
jobs:
cron-lighthouse-report-generator:
name: 'Cron Lighthouse Report Generator'
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
token: ${{ secrets.MASTER_BRANCH_ACCESS_TOKEN }}
- name: Audit URLs using Lighthouse
uses: treosh/lighthouse-ci-action@v9
with:
urls: |
https://web.opentemplatehub.com
uploadArtifacts: true
configPath: .github/lighthouserc.yml
- name: Check for Changes
run: |
rm docs/lighthouse/*
find .lighthouseci -name 'lhr-*.html' -exec sh -c 'x="{}"; cp "$x" "docs/lighthouse/lighthouse-report.html"' \;
rm .lighthouseci/*
if git status --porcelain; then
echo "changes_exist=true" >> $GITHUB_ENV
else
echo "changes_exist=false" >> $GITHUB_ENV
fi
- name: Git Commit and Push
if: ${{ env.changes_exist == 'true' }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "OTH Service User"
git add --all
git commit -am "Workflow/lighthouse report update"
git push