Skip to content

Pull external data source iCloud Private Relay #910

Pull external data source iCloud Private Relay

Pull external data source iCloud Private Relay #910

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