Fetch IPs #5
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 IPs | |
on: | |
schedule: | |
- cron: '0 */2 * * *' # Co 2 godziny | |
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 install | |
- name: Fetch IPs from API and update files | |
run: node worker.js | |
env: | |
SEFIN_API_KEY: ${{ secrets.SEFIN_API_KEY }} | |
- name: Check for changes | |
id: check_changes | |
run: | | |
git status -s > changes.txt | |
echo "has_changes=$(cat changes.txt | wc -l)" >> $GITHUB_ENV | |
- name: Commit and push changes if necessary | |
if: env.has_changes != '0' | |
run: | | |
git config user.name "Sefinek Actions" | |
git config user.email "[email protected]" | |
git add . | |
git commit -am "Update the list of malicious IP addresses" | |
git push origin main | |
env: | |
GITHUB_TOKEN: ${{ secrets.SEFINEK_ACTIONS_PAT }} |