Build yahoo #1297
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: Build yahoo | |
on: | |
push: | |
paths: | |
- '.github/workflows/*' | |
- inputs/yahoo.lsv | |
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 php php-gmp | |
- name: Build list | |
run: | | |
cat inputs/yahoo.lsv | php helpers/loosen.php > /tmp/yahoo.lsv | |
perl ./helpers/cleanup.pl /tmp/yahoo.lsv > yahoo.lsv | |
- name: Test generated Lists | |
run: | | |
if [[ $(grep ^0. yahoo.lsv | wc -l) != "0" ]]; then | |
echo "Lists can not contain 0.0.0.0/8" | |
exit 1 | |
fi | |
if [[ $(grep ^127. yahoo.lsv | wc -l) != "0" ]]; then | |
echo "Lists can not contain 12.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}' yahoo.lsv) | |
if [[ "$ips_covered" -lt 300 ]]; then | |
echo "Too few addresses covered" | |
exit 1 | |
fi | |
if [[ "$ips_covered" -gt 1000 ]]; then | |
echo "Too many addresses covered" | |
exit 1 | |
fi | |
- name: Push Output | |
uses: X4BNet/copy_file_to_another_repo_action@main | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.MY_GITHUB_TOKEN }} | |
with: | |
source_file: 'yahoo.lsv' | |
destination_repo: '${{ github.repository }}' | |
destination_folder: '/outputs/' | |
rename: 'yahoo.txt' | |
user_email: 'automated@x4b.net' | |
user_name: 'listbuilder' | |
destination_branch: "main" | |