Skip to content

Fetch IPs

Fetch IPs #24

Workflow file for this run

name: Fetch IPs
on:
schedule:
- cron: '0 */2 * * *' # At minute 0 past every 2nd hour.
workflow_dispatch:
jobs:
fetch-data:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
ref: main
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- name: Install dependencies
run: npm ci --omit=dev
- name: Fetch IPs from API and update files
run: node worker.js
env:
SEFIN_API_KEY: ${{ secrets.SEFIN_API_KEY }}
- name: Add files to staging
run: git add .
- name: Commit and push changes
run: |
MODIFIED_FILES=$(git status --porcelain)
FILE_COUNT=$(echo "$MODIFIED_FILES" | wc -l)
if [[ $FILE_COUNT -eq 0 ]]; then
echo "Canceled. No files were modified."
exit 0
fi
git config user.name "Sefinek Actions"
git config user.email "[email protected]"
git commit -am "Update the list of malicious IP addresses [$FILE_COUNT files]" -m "$MODIFIED_FILES"
git push origin main