Skip to content

Commit 59c84b3

Browse files
committed
Renew the Public Suffix List from source on schedule
1 parent 32305bf commit 59c84b3

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

.github/workflows/pages.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ on:
66
push:
77
branches: ["main"]
88

9-
# Allows you to run this workflow manually from the Actions tab
9+
# Renew the Public Suffix List on schedule or manually
10+
schedule:
11+
- cron: '12 3 * * *'
1012
workflow_dispatch:
1113

1214
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
@@ -33,10 +35,16 @@ jobs:
3335

3436
- name: Download Public Suffix List
3537
run: |
36-
urls=(
37-
"https://upa-url.github.io/demo/public_suffix_list.dat"
38-
"https://publicsuffix.org/list/public_suffix_list.dat"
39-
)
38+
if [ "${{ github.event_name }}" = "push" ]; then
39+
# First, try using the same file
40+
urls=(
41+
"https://upa-url.github.io/demo/public_suffix_list.dat"
42+
"https://publicsuffix.org/list/public_suffix_list.dat"
43+
)
44+
else
45+
# Renew file from source
46+
urls=("https://publicsuffix.org/list/public_suffix_list.dat")
47+
fi
4048
for u in "${urls[@]}"; do
4149
if curl -fsS -o public/demo/public_suffix_list.dat "$u"; then
4250
break

0 commit comments

Comments
 (0)