-
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (39 loc) · 1.14 KB
/
fetch-ips.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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.ACTIONS_SECRET }}