Cronjob - Audit Web Perf #307
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: Cronjob - Audit Web Perf | |
on: | |
schedule: | |
- cron: "0 3 * * 0" | |
workflow_dispatch: | |
jobs: | |
run_audit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 8 | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Updating last update timestamp | |
run: | | |
cat > reports/LAST_UPDATED | |
d=`date '+%Y-%m-%dT%H:%M:%SZ'` | |
echo $d > reports/LAST_UPDATED | |
- name: Commit LAST_UPDATED | |
run: | | |
git config --local user.email "mazipanneh@gmail.com" | |
git config --local user.name "mazipan" | |
git config --global --add safe.directory /github/workspace | |
git add -A | |
git commit -m "chore: auto update file LAST_UPDATED" --no-verify | |
- name: Push LAST_UPDATED to master | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GIT_TOKEN }} | |
directory: ./reports | |
force: true | |
- name: Run web perf job | |
run: pnpm run job:webtest | |
env: | |
PSI_API_KEY: ${{ secrets.PSI_API_KEY }} | |
LIGHTHOUSE_API_KEY: ${{ secrets.LIGHTHOUSE_API_KEY }} | |
GIST_TOKEN: ${{ secrets.GIST_TOKEN }} | |
GIST_ID: ${{ secrets.GIST_ID }} | |
- name: Commit files report to master | |
run: | | |
git config --local user.email "mazipanneh@gmail.com" | |
git config --local user.name "mazipan" | |
git config --global --add safe.directory /github/workspace | |
git add -A | |
git commit -m "👋 Generated report 🚀" --no-verify | |
- name: Push report to master | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GIT_TOKEN }} | |
directory: ./reports | |
force: true |