Pull external data source iCloud Private Relay #708
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: 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 |