File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
Expand file tree Collapse file tree 1 file changed +48
-0
lines changed 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 PR branch
18+ uses : actions/checkout@v4
19+ with :
20+ fetch-depth : 0
21+ ref : ${{ github.event.pull_request.head.ref }}
22+
23+ - name : Set up Python
24+ uses : actions/setup-python@v4
25+ with :
26+ python-version : ' 3.x'
27+
28+ - name : Install dependencies
29+ run : pip install python-dateutil
30+
31+ - name : Configure Git
32+ run : |
33+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
34+ git config --global user.name "github-actions[bot]"
35+
36+ - name : Update last modified date in Markdown files
37+ run : python .github/workflows/update_date.py
38+
39+ - name : Pull (merge) remote changes, commit, and push if needed
40+ env :
41+ TOKEN : ${{ secrets.GITHUB_TOKEN }}
42+ run : |
43+ BRANCH="${{ github.event.pull_request.head.ref }}"
44+ git pull origin "$BRANCH" || echo "No merge needed"
45+ git add -A
46+ git commit -m "Update last modified date in Markdown files" || echo "No changes to commit"
47+ git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }}
48+ git push origin HEAD:"$BRANCH"
You can’t perform that action at this time.
0 commit comments