Skip to content

Commit c2a14a6

Browse files
Add GitHub Actions workflow for daily auto commits
1 parent dfa8f4d commit c2a14a6

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/smart.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Smart Daily Commits (UTC)
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *" # Har kuni UTC 00:00
6+
workflow_dispatch:
7+
8+
jobs:
9+
smart-commits:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Decide commit count (even=5, odd=6)
17+
id: decide
18+
run: |
19+
DAY=$(date +%u) # 1=Mon … 7=Sun
20+
21+
if [ $((DAY % 2)) -eq 0 ]; then
22+
COUNT=5
23+
else
24+
COUNT=5
25+
fi
26+
27+
echo "count=$COUNT" >> $GITHUB_OUTPUT
28+
29+
- name: Make commits
30+
env:
31+
GH_PAT: ${{ secrets.GH_PAT }}
32+
run: |
33+
git config --global user.name "github-actions[bot]"
34+
git config --global user.email "[email protected]"
35+
36+
COUNT=${{ steps.decide.outputs.count }}
37+
38+
for i in $(seq 1 $COUNT); do
39+
echo "Update $i: $(date -u)" >> activity-log.txt
40+
git add activity-log.txt
41+
git commit -m "Auto commit $i (UTC $(date -u '+%H:%M:%S'))" || echo "No changes"
42+
done
43+
44+
git push https://[email protected]/baxtiff05-cell/auto-commit.git HEAD:main

0 commit comments

Comments
 (0)