-
Notifications
You must be signed in to change notification settings - Fork 1
37 lines (35 loc) · 1.06 KB
/
update-data.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
name: Update data
on:
workflow_dispatch:
schedule:
- cron: '*/45 * * * *' # https://crontab.guru/#*/45_*_*_*_*
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- env:
FILES: |
ip2asn-v4.tsv
ip2asn-v4-u32.tsv
ip2asn-v6.tsv
ip2asn-combined.tsv
ip2country-v4.tsv
ip2country-v4-u32.tsv
ip2country-v6.tsv
run: |
for file in $FILES; do
curl -sSfL "https://iptoasn.com/data/$file.gz" > data/$file.gz
done
- run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- id: commit
run: |
git add data/*.gz
if ! git diff-index --quiet HEAD; then
git commit -m "Update data ($(date +'%Y-%m-%d %H:%M:%S'))"
git log -1 --pretty=format:%H | xargs -I {} echo "id={}" | tee -a $GITHUB_OUTPUT
fi
- if: steps.commit.outputs.id
run: git push