1
- name : GET Cloudflare
1
+ name : Fetch Cloudflare Data
2
2
3
3
on :
4
4
schedule :
5
- # At 6am every night
6
- - cron : ' 0 6 * * *'
5
+ # Run at 6:00 AM UTC daily
6
+ - cron : ' 0 6 * * *'
7
7
8
8
jobs :
9
- get-data :
10
-
9
+ fetch-cloudflare-data :
11
10
runs-on : ubuntu-latest
12
11
13
12
steps :
14
- - uses : actions/checkout@v2
15
- - name : Use Node.js
16
- uses : actions/setup-node@v1
13
+ - name : Checkout Repository
14
+ uses : actions/checkout@v3
15
+
16
+ - name : Set up Node.js
17
+ uses : actions/setup-node@v3
17
18
with :
18
- node-version : ' 12.x'
19
- - run : npm install
20
- - name : Fetch Cloudflare data
19
+ node-version : ' 18.x'
20
+
21
+ - name : Install Dependencies
22
+ run : npm ci
23
+
24
+ - name : Fetch Cloudflare Data
21
25
env :
22
26
CLOUDFLARE_ZONE_TAG : ${{ secrets.CLOUDFLARE_ZONE_TAG }}
23
27
CLOUDFLARE_EMAIL : ${{ secrets.CLOUDFLARE_EMAIL }}
24
28
CLOUDFLARE_API_KEY : ${{ secrets.CLOUDFLARE_API_KEY }}
25
29
run : npm run get-cloudflare
26
- - name : check for changes
27
- run : git status
28
- - name : stage changed files
30
+
31
+ - name : Check for Changes
32
+ run : |
33
+ git status
34
+ if git diff --quiet; then
35
+ echo "No changes detected. Exiting..."
36
+ exit 0
37
+ fi
38
+
39
+ - name : Stage and Commit Changes
29
40
run : |
30
41
git config --local user.name "ocf-bot"
31
42
git config --local user.email "[email protected] "
32
43
git add .
33
- git commit -m "🗃 Add latest cloudflare data"
34
- - name : fetch from main
35
- run : git fetch origin main
36
- - name : push code to main
37
- run : git push origin HEAD:main
44
+ git commit -m "🗃 Add latest Cloudflare data"
45
+
46
+ - name : Fetch and Rebase Main
47
+ run : |
48
+ git fetch origin main
49
+ git pull --rebase origin main
50
+
51
+ - name : Push Changes to Main
52
+ run : git push origin HEAD:main
0 commit comments