Pull external data source Google One VPN IP Ranges #441
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 Google One VPN IP Ranges | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 */3 * * *" | |
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://www.gstatic.com/g1vpn/geofeed | Select-Object -ExpandProperty Content | ConvertFrom-Csv -Header @('IPRange', 'Country', 'LanguageCode', 'City') | |
$IPRanges = $IPRanges | Where-Object { $_.IPRange -notmatch '^#' } | |
foreach ($IPRange in $IPRanges) { | |
if ($IPRange.IPRange -notmatch '^#') { | |
$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/GoogleOneVPNIPRanges.csv -Force | |
- name: Commit updated data to repo | |
uses: stefanzweifel/git-auto-commit-action@v5 |