Skip to content

Commit b9bf7a6

Browse files
authored
Update daily.yml
1 parent 423c5b3 commit b9bf7a6

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

.github/workflows/daily.yml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,40 @@
11
name: Daily Contribution
22

33
permissions:
4-
contents: write
4+
contents: write # Required to let GITHUB_TOKEN push commits
55

66
on:
77
schedule:
8-
# Runs daily at 07:00 UTC 12:30 PM IST (safe zone)
8+
# 07:00 UTC = ~12:30 PM IST — good safe time
99
- cron: '0 7 * * *'
10-
workflow_dispatch:
10+
workflow_dispatch: # Lets you trigger manually from the Actions tab if you want
1111

1212
jobs:
1313
auto-contribute:
1414
runs-on: ubuntu-latest
15-
1615
steps:
1716
- name: Checkout repository
18-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4 # ← Updated to latest version (v4 is current in 2026)
1918
with:
20-
persist-credentials: true
19+
# No need for persist-credentials: true anymore in v4 — it handles auth better internally
2120

22-
# Random delay (0–2 hours) to look natural
23-
- name: Random delay
24-
run: |
25-
echo "Sleeping for random delay..."
26-
sleep $((RANDOM % 7200))
21+
- name: Random delay (0–2 hours) to look more natural
22+
run: sleep $((RANDOM % 7200 + 1)) # +1 avoids exactly 0 sec
2723

28-
- name: Make daily commit (IST)
24+
- name: Make daily commit (in IST timezone)
2925
run: |
30-
export TZ="Asia/Kolkata"
31-
echo "Daily update: $(date)" >> log.txt
26+
# Set timezone so date shows IST correctly in commit message
27+
export TZ=Asia/Kolkata
3228
33-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
34-
git config user.name "github-actions[bot]"
29+
# Append a line with current IST time — keeps file changing
30+
echo "Daily auto update: $(date '+%Y-%m-%d %H:%M:%S %Z')" >> log.txt
31+
32+
git config user.name "NABORAJ SARAKR"
33+
git config user.email "nishant.ns.business@gmail.com"
3534
3635
git add log.txt
37-
git commit -m "chore: daily contribution"
38-
git push
36+
# Only commit if there are changes (prevents empty commit errors)
37+
git diff --staged --quiet || git commit -m "chore: daily contribution $(date '+%Y-%m-%d')"
38+
39+
# Push — GITHUB_TOKEN has write permission from the permissions: block
40+
git push origin HEAD

0 commit comments

Comments
 (0)