-
Notifications
You must be signed in to change notification settings - Fork 3
115 lines (109 loc) · 5.5 KB
/
lighthouse-badger-advanced.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Lighthouse-Badger-Advanced | GitHub Action Workflow
#
# Description: Generates, adds & updates manually/automatically Lighthouse badges & reports from one/multiple input URL-group(s) to one/multiple target repo(s)/branch(es) in parallel
# Author: Sitdisch
# Source: https://github.com/myactionway/lighthouse-badger-workflows
# License: MIT
# Copyright (c) 2021 Sitdisch
name: 'Lighthouse-Badger-Advanced'
########################################################################
# DEFINE YOUR DEFAULTS (INPUTS & TRIGGERS) IN THE FOLLOWING
########################################################################
# INPUTS as environmental variables (env)
env:
TOKEN_NAME: # target token name; insert only the name never the real value e.g. 'LIGHTHOUSE_BADGER_TOKEN'
# To change predefined values, just override them
REPO_BRANCH: '${{ github.repository }} main' # target repository & branch (predefined: repo with this file and main branch)
USER_NAME: 'github-actions[bot]' # user who should commit
USER_EMAIL: '41898282+github-actions[bot]@users.noreply.github.com'
AUDIT_TYPE: 'both' # 'mobile', 'desktop', 'both' or 'both_p'
MOBILE_LIGHTHOUSE_PARAMS: '--throttling.cpuSlowdownMultiplier=2' # Lighthouse parameters mobile audit
DESKTOP_LIGHTHOUSE_PARAMS: '--preset=desktop --throttling.cpuSlowdownMultiplier=1' # Lighthouse parameters desktop audit
COMMIT_MESSAGE: 'Lighthouse-Badger[bot]: Results Added'
# TRIGGERS
on:
# page_build:
# schedule: # Check your schedule here => https://crontab.guru/
# - cron: '55 23 * * 0' # e.g. every Sunday at 23:55
workflow_dispatch:
# No predefined inputs; The env defined in this file are used instead when this trigger is triggered.
########################################################################
# YOU CAN JUMP TO THE FIRST URL-GROUP DEFINITION BELOW
########################################################################
jobs:
lighthouse-badger-advanced:
name: ${{ matrix.NAME }}
runs-on: ubuntu-22.04
timeout-minutes: 8
strategy:
fail-fast: false
matrix:
include:
##############################################################
# FIRST URL-GROUP | DEFINE YOUR ENV IN THE FOLLOWING
##############################################################
- NAME: # e.g. 'URL-GROUP 1'
URLS: # e.g. 'https://github.com/sitdisch https://github.com/mythemeway'
BADGES_ARGS: # e.g. '-b pagespeed -o lighthouse_results/first_group -r'
# Your defaults will be used unless you redefine a following env
# TOKEN_NAME:
# REPO_BRANCH:
# AUDIT_TYPE:
# MOBILE_LIGHTHOUSE_PARAMS:
# DESKTOP_LIGHTHOUSE_PARAMS:
# USER_NAME:
# USER_EMAIL:
# COMMIT_MESSAGE: # e.g. 'Lighthouse-Badger[bot]: Results Added | First URL-Group'
##############################################################
# SECOND URL-GROUP | DEFINE YOUR ENV IN THE FOLLOWING
##############################################################
- NAME: # e.g. 'URL-GROUP 2'
URLS: # e.g. 'https://mythemeway.github.io/Dark-Particle/ https://mythemeway.github.io/Dark-Particle/projects/2020/10/31/project-1.html'
BADGES_ARGS: # e.g. '-b flat -o lighthouse_results/second_group -r'
# Your defaults will be used unless you redefine a following env
# TOKEN_NAME:
# REPO_BRANCH:
# AUDIT_TYPE:
# MOBILE_LIGHTHOUSE_PARAMS:
# DESKTOP_LIGHTHOUSE_PARAMS:
# USER_NAME:
# USER_EMAIL:
# COMMIT_MESSAGE: # e.g. 'Lighthouse-Badger[bot]: Results Added | Second URL-Group'
##############################################################
# THIRD URL-GROUP | FEEL FREE TO ADD MORE URL-GROUPS LIKE ABOVE
##############################################################
#
# ...
#
####################################################################
# THAT'S IT; YOU DON'T HAVE TO DEFINE ANYTHING IN THE FOLLOWING
####################################################################
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: ${{ matrix.REPO_BRANCH || env.REPO_BRANCH }}
- uses: actions/checkout@v3
with:
repository: ${{ env.REPOSITORY }}
token: ${{ secrets[matrix.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: ${{ matrix.URLS }}
badges_args: ${{ matrix.BADGES_ARGS }}
audit_type: ${{ matrix.AUDIT_TYPE || env.AUDIT_TYPE }}
mobile_lighthouse_params: ${{ matrix.MOBILE_LIGHTHOUSE_PARAMS || env.MOBILE_LIGHTHOUSE_PARAMS }}
desktop_lighthouse_params: ${{ matrix.DESKTOP_LIGHTHOUSE_PARAMS || env.DESKTOP_LIGHTHOUSE_PARAMS }}
user_name: ${{ matrix.USER_NAME || env.USER_NAME }}
user_email: ${{ matrix.USER_EMAIL || env.USER_EMAIL }}
commit_message: ${{ matrix.COMMIT_MESSAGE || env.COMMIT_MESSAGE }}
max_push_attempts: 5