-
Notifications
You must be signed in to change notification settings - Fork 17
30 lines (25 loc) · 1.26 KB
/
ExternalData-iCloudPrivateRelayIPRanges.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
name: Pull external data source iCloud Private Relay
on:
workflow_dispatch:
schedule:
- cron: "0 */2 * * *"
jobs:
pull-external-data:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout main
uses: actions/checkout@v4
- name: Pull external data and modify if needed
shell: pwsh
run: |
$IPRanges = Invoke-WebRequest -Uri https://mask-api.icloud.com/egress-ip-ranges.csv | Select-Object -ExpandProperty Content | ConvertFrom-Csv -Header @('IPRange', 'Country', 'LanguageCode', 'City')
foreach ($IPRange in $IPRanges) {
$AddressFamily = [IPAddress]($IPRange.IPRange -replace '/.*') | Select-Object -ExpandProperty AddressFamily
$IPRange | Add-Member -MemberType NoteProperty -Name AddressFamily -Value $AddressFamily
}
if (-not (Test-Path -Path "${{ github.workspace }}/ExternalData/")) { New-Item -ItemType Directory -Path "${{ github.workspace }}/ExternalData/" -ErrorAction SilentlyContinue }
$IPRanges | Export-Csv -Path ${{ github.workspace }}/ExternalData/iCloudPrivateRelayIPRanges.csv -Force
- name: Commit updated data to repo
uses: stefanzweifel/git-auto-commit-action@v5