Skip to content

Pull external data source Google One VPN IP Ranges #596

Pull external data source Google One VPN IP Ranges

Pull external data source Google One VPN IP Ranges #596

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