Fetch: ProtonVPN #1260
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: "Fetch: ProtonVPN" | |
on: | |
push: | |
paths: | |
- '.github/workflows/fetch-protonvpn.yml' | |
schedule: | |
- cron: '30 8 * * *' | |
workflow_dispatch: | |
jobs: | |
build_and_commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Dependencies | |
run: | | |
sudo apt-get install jq | |
- name: Download and process | |
run: | | |
curl https://api.protonmail.ch/vpn/logicals | jq '.LogicalServers[].Servers[].ExitIP' -r | sort -n > /tmp/protonvpn.txt | |
- name: Merge Lists | |
run: | | |
perl ./helpers/cleanup.pl /tmp/protonvpn.txt > protonvpn.txt | |
- name: Test generated Lists | |
run: | | |
if [[ $(grep ^0. protonvpn.txt | wc -l) != "0" ]]; then | |
echo "Lists can not contain 0.0.0.0/8" | |
exit 1 | |
fi | |
if [[ $(grep ^127. protonvpn.txt | wc -l) != "0" ]]; then | |
echo "Lists can not contain 127.0.0.1/8" | |
exit 1 | |
fi | |
ips_covered=$(awk -F/ 'BEGIN{a=0}{if($2==""){a+=1}else{a+=2^(32-$2)}}END{print a}' protonvpn.txt) | |
if [[ "$ips_covered" -lt 4000 ]]; then | |
echo "Too few addresses covered ($ips_covered)" | |
exit 1 | |
fi | |
if [[ "$ips_covered" -gt 8000 ]]; then | |
echo "Too many addresses covered ($ips_covered)" | |
exit 1 | |
fi | |
- name: Push Output of protonvpn.txt | |
uses: X4BNet/copy_file_to_another_repo_action@main | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.MY_GITHUB_TOKEN }} | |
with: | |
source_file: 'protonvpn.txt' | |
destination_repo: '${{ github.repository }}' | |
destination_folder: '/input/vpn/ips/' | |
user_email: '[email protected]' | |
user_name: 'listbuilder' | |
destination_branch: "main" | |