Skip to content

Commit bf23064

Browse files
authored
Add workflow to update last modified date in Markdown
1 parent 4554dbc commit bf23064

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Update Last Modified Date
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
update-date:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.x'
22+
23+
- name: Install dependencies
24+
run: pip install python-dateutil
25+
26+
- name: Configure Git
27+
run: |
28+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
29+
git config --global user.name "github-actions[bot]"
30+
31+
- name: Update last modified date in Markdown files
32+
run: python .github/workflows/update_date.py
33+
34+
- name: Commit changes
35+
env:
36+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
run: |
38+
git fetch origin
39+
git pull --rebase origin ${{ github.event.pull_request.head.ref }} || echo "No rebase needed"
40+
git add -A
41+
git commit -m "Update last modified date in Markdown files" || echo "No changes to commit"
42+
git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }}
43+
git push origin HEAD:${{ github.event.pull_request.head.ref }}

0 commit comments

Comments
 (0)