-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (31 loc) · 1.17 KB
/
update-commits.yml
File metadata and controls
37 lines (31 loc) · 1.17 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
name: Update Recent Commits
on:
push:
branches: [ main ]
workflow_dispatch:
permissions:
contents: write
jobs:
update-commits:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 10 # Fetch last 10 commits
- name: Generate commits data
run: |
echo "# Recent commits data for Jekyll" > docs/_data/recent_commits.yml
echo "# Auto-generated by GitHub Actions" >> docs/_data/recent_commits.yml
echo "commits:" >> docs/_data/recent_commits.yml
# Get last 5 commits
git log --pretty=format:'- sha: "%H"%n date: "%ad"%n author: "%an"%n subject: "%s"%n body: "%b"%n' \
--date=format:'%B %d, %Y' \
-n 5 >> docs/_data/recent_commits.yml
- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add docs/_data/recent_commits.yml
git diff --staged --quiet || git commit -m "Update recent commits data [skip ci]"
git push || echo "No changes to push"