-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (50 loc) · 1.72 KB
/
PSI-scores-to-svg.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
name: PSI-scores-to-SVG
on:
workflow_dispatch:
schedule:
- cron: '31 5 * * 1'
push:
branches:
- main
jobs:
getpsresults:
env:
URLS: https://bucketlisty.com
PSURL: https://pagespeed-insights-svg.glitch.me
PSRDESKTOP: psi-audit-desktop
PSRMOBILE: psi-audit-mobile
RESULTSFOLDER: reports
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- name: Create local changes
run: |
mkdir -p ${RESULTSFOLDER}
IFS=',' read -r -a HOSTS <<< $URLS
for i in "${!HOSTS[@]}"; do
position=$(( $i + 1 ))
while [ ! "$auditDesktop" ]; do
auditDesktop=$(curl "${PSURL}/?url=${HOSTS[$i]}&theme=dark&categories=30&tests=3")
done
cat <<< "$auditDesktop" > ./${RESULTSFOLDER}/${PSRDESKTOP}-${position}.svg
while [ ! "$auditMobile" ]; do
auditMobile=$(curl "${PSURL}/?url=${HOSTS[$i]}&strategy=mobile&theme=dark&categories=30&tests=3")
done
cat <<< "$auditMobile" > ./${RESULTSFOLDER}/${PSRMOBILE}-${position}.svg
unset auditDesktop
unset auditMobile
done
- name: Commit files
run: |
git add .
git config --local user.email "[email protected]"
git config --local user.name "github-actions[bot]"
git diff --quiet && git diff --staged --quiet || git commit -am "🔁 CI" -m "Updated PageSpeed Insights results SVGs"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}