Skip to content

Commit 970cc0b

Browse files
authored
Update auto-green.yml
1 parent 48b7d6c commit 970cc0b

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

.github/workflows/auto-green.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
1-
name: Auto Green Bot
1+
name: Auto Green
22

33
on:
44
schedule:
5-
- cron: "*/30 * * * *"
5+
- cron: "*/30 * * * *" # cek tiap 30 menit
66
workflow_dispatch:
77

88
permissions:
99
contents: write
1010

11-
concurrency:
12-
group: auto-green
13-
cancel-in-progress: true
14-
1511
jobs:
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))
@@ -43,6 +44,8 @@ jobs:
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

0 commit comments

Comments
 (0)