Skip to content

Lighthouse-Badger-Default #216

Lighthouse-Badger-Default

Lighthouse-Badger-Default #216

name: 'Lighthouse-Badger-Default'
env:
URLS: 'https://code-leap-gabrielguedess.vercel.app https://code-leap-gabrielguedess.vercel.app/posts'
TOKEN_NAME: 'LIGHTHOUSE_BADGER_TOKEN'
REPO_BRANCH: '${{ github.repository }} main'
BADGES_ARGS: '-b pagespeed -o .github/assets/lighthouse -r'
AUDIT_TYPE: 'desktop'
MOBILE_LIGHTHOUSE_PARAMS: '--throttling.cpuSlowdownMultiplier=2'
DESKTOP_LIGHTHOUSE_PARAMS: '--preset=desktop --throttling.cpuSlowdownMultiplier=1'
USER_NAME: 'github-actions[bot]'
USER_EMAIL: '41898282+github-actions[bot]@users.noreply.github.com'
COMMIT_MESSAGE: 'docs: Lighthouse-Badger[bot]: Results Added'
DEFAULT_REPO_BRANCH: '${{ github.repository }} main'
DEFAULT_BADGES_ARGS: '-b pagespeed -o .github/assets/lighthouse -r'
DEFAULT_AUDIT_TYPE: 'desktop'
DEFAULT_MOBILE_LIGHTHOUSE_PARAMS: '--throttling.cpuSlowdownMultiplier=2'
DEFAULT_DESKTOP_LIGHTHOUSE_PARAMS: '--preset=desktop --throttling.cpuSlowdownMultiplier=1'
DEFAULT_USER_NAME: 'github-actions[bot]'
DEFAULT_USER_EMAIL: '41898282+github-actions[bot]@users.noreply.github.com'
DEFAULT_COMMIT_MESSAGE: 'docs: Lighthouse-Badger[bot]: Results Added'
on:
schedule:
- cron: '55 23 * * 0'
workflow_dispatch:
inputs:
urls:
description: 'URL(s) to be checked'
required: true
token_name:
description: 'Target token name (NO VALUE!)'
required: true
repo_branch:
description: 'Target repository & branch'
required: true
badges_args:
description: 'Badges arguments: -b, -l, -o, -r, -s'
required: true
default: '-b pagespeed -o .github/assets/lighthouse -r'
audit_type:
description: 'Audit type: mobile, desktop, both or both_p'
required: true
default: 'desktop'
mobile_lighthouse_params:
description: 'Lighthouse parameters mobile audit'
required: true
default: '--throttling.cpuSlowdownMultiplier=2'
desktop_lighthouse_params:
description: 'Lighthouse parameters desktop audit'
required: true
default: '--preset=desktop --throttling.cpuSlowdownMultiplier=1'
user_name:
description: 'User who should commit'
required: true
default: 'github-actions[bot]'
user_email:
description: 'User e-mail address'
required: true
default: '41898282+github-actions[bot]@users.noreply.github.com'
commit_message:
description: 'Commit message'
required: true
default: 'Lighthouse-Badger[bot]: Results Added'
jobs:
lighthouse-badger-default:
runs-on: ubuntu-22.04
if: ${{ github.actor != 'github-actions[bot]' }}
timeout-minutes: 8
steps:
- name: Preparatory Tasks
run: |
REPOSITORY=`expr "${{ env.REPO_BRANCH }}" : "\([^ ]*\)"`
BRANCH=`expr "${{ env.REPO_BRANCH }}" : ".* \([^ ]*\)"`
echo "REPOSITORY=$REPOSITORY" >> $GITHUB_ENV
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
env:
REPO_BRANCH: ${{ github.event.inputs.repo_branch || env.REPO_BRANCH || env.DEFAULT_REPO_BRANCH }}
- uses: actions/checkout@v3
with:
repository: ${{ env.REPOSITORY }}
token: ${{ secrets[github.event.inputs.token_name] || secrets[env.TOKEN_NAME] }}
ref: ${{ env.BRANCH }}
- uses: actions/checkout@v3
with:
repository: 'myactionway/lighthouse-badges'
path: temp_lighthouse_badges_nested
- uses: myactionway/lighthouse-badger-action@v2.2
with:
urls: ${{ github.event.inputs.urls || env.URLS }}
badges_args: ${{ github.event.inputs.badges_args || env.BADGES_ARGS || env.DEFAULT_BADGES_ARGS }}
audit_type: ${{ github.event.inputs.audit_type || env.AUDIT_TYPE || env.DEFAULT_AUDIT_TYPE }}
mobile_lighthouse_params: ${{ github.event.inputs.mobile_lighthouse_params || env.MOBILE_LIGHTHOUSE_PARAMS || env.DEFAULT_MOBILE_LIGHTHOUSE_PARAMS }}
desktop_lighthouse_params: ${{ github.event.inputs.desktop_lighthouse_params || env.DESKTOP_LIGHTHOUSE_PARAMS || env.DEFAULT_DESKTOP_LIGHTHOUSE_PARAMS }}
user_name: ${{ github.event.inputs.user_name || env.USER_NAME || env.DEFAULT_USER_NAME }}
user_email: ${{ github.event.inputs.user_email || env.USER_EMAIL || env.DEFAULT_USER_EMAIL }}
commit_message: ${{ github.event.inputs.commit_message || env.COMMIT_MESSAGE || env.DEFAULT_COMMIT_MESSAGE }}
max_push_attempts: 5