Update data #12492
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |