File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed
Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change 1- name : Auto Green Bot
1+ name : Auto Green
22
33on :
44 schedule :
5- - cron : " */30 * * * *"
5+ - cron : " */30 * * * *" # cek tiap 30 menit
66 workflow_dispatch :
77
88permissions :
99 contents : write
1010
11- concurrency :
12- group : auto-green
13- cancel-in-progress : true
14-
1511jobs :
1612 auto-green :
1713 runs-on : ubuntu-latest
18-
1914 steps :
2015 - name : Checkout repo pakai PAT pribadi
2116 uses : actions/checkout@v4
2217 with :
2318 token : ${{ secrets.PAT_TOKEN }}
19+ fetch-depth : 0
2420
25- - name : Random delay (0-30 menit) biar berasa 30-60 menit
26- run : sleep $(( RANDOM % 1800 ))
21+ - name : Randomize interval (skip 50% runs)
22+ run : |
23+ # 50% skip -> rata-rata commit tiap ~60 menit
24+ if [ $((RANDOM % 2)) -eq 0 ]; then
25+ echo "Random skip this run."
26+ exit 0
27+ fi
2728
28- - name : Generate random data
29+ - name : Generate random data (always changes)
2930 run : |
3031 TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
3132 RANDOM_NUM=$((RANDOM % 10000))
4344 run : |
4445 git config user.name "${GIT_USER}"
4546 git config user.email "${GIT_EMAIL}"
47+
4648 git add data.json
47- git commit -m "🌱 Auto update by ${GIT_USER} - $(date -u +"%Y-%m-%d %H:%M:%S")" || echo "Tidak ada perubahan untuk di-commit"
49+ git commit -m "🌱 Auto update by ${GIT_USER} - $(date -u +"%Y-%m-%d %H:%M:%S UTC")" || exit 0
50+
4851 git push https://x-access-token:${TOKEN}@github.com/${{ github.repository }}.git HEAD:main
You can’t perform that action at this time.
0 commit comments