-
Notifications
You must be signed in to change notification settings - Fork 2
67 lines (56 loc) · 2.41 KB
/
hourly-commit.yml
File metadata and controls
67 lines (56 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Hourly Commit
on:
schedule:
- cron: '*/30 * * * *' # Every 30 minutes
workflow_dispatch:
jobs:
auto-commit:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Update stats and README
run: |
git config --global user.name "HOLYKEYZ"
git config --global user.email "ayandajoseph390@gmail.com"
# Update stats file
echo "{\"last_updated\": \"$(date -u '+%Y-%m-%d %H:%M:%S UTC')\", \"commit_count\": $(git rev-list --count HEAD), \"total_contributors\": $(git shortlog -sn | wc -l)}" > .github/stats.json
# Update README with timestamp
if [ -f README.md ]; then
# Add/update activity section
if grep -q "## Activity" README.md; then
sed -i "s/Last updated:.*/Last updated: $(date -u '+%Y-%m-%d %H:%M:%S UTC')/" README.md
else
echo -e "\n## Activity\n> Last updated: $(date -u '+%Y-%m-%d %H:%M:%S UTC')\n" >> README.md
fi
fi
- name: Update CI/CD status
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
echo "# CI/CD Status" > .github/ci_status.md
echo "Last sync: $(date -u)" >> .github/ci_status.md
echo "" >> .github/ci_status.md
curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/actions/runs?per_page=5" | \
grep -o '"name":"[^"]*"|"conclusion":"[^"]*"' | \
sed 's/"name":"/Workflow: /g' | sed 's/","|"conclusion":"/ - /g' >> .github/ci_status.md || \
echo "Status unavailable" >> .github/ci_status.md
- name: Commit and push
run: |
git config --global user.name "HOLYKEYZ"
git config --global user.email "ayandajoseph390@gmail.com"
# Update activity tracker
echo "$(date -u '+%Y-%m-%d %H:%M:%S UTC')" > .github/activity_tracker.txt
# Remove old keep_active if exists
rm -f .github/.keep_active
git add .github/activity_tracker.txt .github/stats.json .github/ci_status.md
git commit -m "chore: $(date -u '+%Y-%m-%d %H:%M') sync"
git push