Build Database Update #1664
This file contains hidden or 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: 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 zutils | |
| - name: Downloading SFS IP list | |
| run: | | |
| curl http://www.stopforumspam.com/downloads/listed_ip_1.zip > /tmp/sfs.lsv.zip | |
| unzip /tmp/sfs.lsv.zip | |
| mv listed_ip_1.txt /tmp/sfs.lsv | |
| - name: Build list | |
| run: | | |
| perl ./helpers/cleanup.pl /tmp/sfs.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 3000 ]]; then | |
| echo "Too few addresses covered" | |
| exit 1 | |
| fi | |
| if [[ "$ips_covered" -gt 30000 ]]; 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: '[email protected]' | |
| user_name: 'listbuilder' | |
| destination_branch: "main" | |