-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (39 loc) · 1.4 KB
/
update-ips.yml
File metadata and controls
50 lines (39 loc) · 1.4 KB
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: Update IP Ranges
on:
schedule:
# Runs every day at 00:00 UTC
- cron: '0 0 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write # Required to push changes to the repo
jobs:
update-ips:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Fetch IP Ranges
run: |
# Telegram
curl https://core.telegram.org/resources/cidr.txt > telegram.txt
# Google
curl https://www.gstatic.com/ipranges/goog.json | jq -r '.prefixes [] | .ipv4Prefix | select( . != null )' > google.txt
# Apple
echo 17.0.0.0/8 > apple.txt
#DigitalOcean
curl -sL https://www.digitalocean.com/geo/google.csv | grep -E '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/' | cut -d',' -f1 > digitalocean.txt
#AmazonAWS
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r '.prefixes[].ip_prefix' > aws.txt
- name: Commit and push changes
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "actions@github.com"
git add -A
# Check if there are changes to commit
if git diff --staged --quiet; then
echo "No changes to commit."
else
git commit -m "Automated update of IP ranges"
git push
fi