File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,10 +14,11 @@ jobs:
1414 runs-on : ubuntu-latest
1515
1616 steps :
17- - name : Checkout repository
17+ - name : Checkout PR branch
1818 uses : actions/checkout@v4
1919 with :
2020 fetch-depth : 0
21+ ref : ${{ github.event.pull_request.head.ref }}
2122
2223 - name : Set up Python
2324 uses : actions/setup-python@v4
@@ -35,13 +36,13 @@ jobs:
3536 - name : Update last modified date in Markdown files
3637 run : python .github/workflows/update_date.py
3738
38- - name : Commit changes
39+ - name : Pull (merge) remote changes, commit, and push if needed
3940 env :
4041 TOKEN : ${{ secrets.GITHUB_TOKEN }}
4142 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"
43+ BRANCH=" ${{ github.event.pull_request.head.ref }}"
44+ git pull origin "$BRANCH" || echo "No merge needed"
4445 git add -A
4546 git commit -m "Update last modified date in Markdown files" || echo "No changes to commit"
4647 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 }}
48+ git push origin HEAD:"$BRANCH"
You can’t perform that action at this time.
0 commit comments