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