Skip to content

Build Database Update #123

Build Database Update

Build Database Update #123

Workflow file for this run

name: Build Database Update
on:
push:
paths:
- '.github/workflows/*'
workflow_dispatch:
schedule:
- cron: '15 8 * * *'
jobs:
build_and_commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Dependencies
run: |
sudo apt-get install ipcalc
- name: Downloading TOR Exit node list
run: |
curl https://uptimerobot.com/inc/files/ips/IPv4.txt > /tmp/ur.lsv
- name: Build list
run: |
perl ./helpers/cleanup.pl /tmp/ur.lsv > ipv4.txt
- name: Test generated Lists
run: |
if [[ $(grep ^0. ipv4.txt | wc -l) != "0" ]]; then
echo "Lists can not contain 0.0.0.0/8"
exit 1
fi
if [[ $(grep ^127. ipv4.txt | wc -l) != "0" ]]; then
echo "Lists can not contain 12.0.0.1/8"
exit 1
fi
ips_covered=$(awk -F/ 'BEGIN{a=0}{a+=2^(32-$2)}END{print a}' ipv4.txt)
if [[ "$ips_covered" -lt 30 ]]; then
echo "Too few addresses covered"
exit 1
fi
if [[ "$ips_covered" -gt 200 ]]; then
echo "Too many addresses covered"
exit 1
fi
- name: Push Output of ipv4.txt
uses: X4BNet/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.MY_GITHUB_TOKEN }}
with:
source_file: 'ipv4.txt'
destination_repo: '${{ github.repository }}'
destination_folder: '/'
user_email: 'automated@x4b.net'
user_name: 'listbuilder'
destination_branch: "main"