Skip to content

Commit 8602268

Browse files
authored
current branch
1 parent 38e1a28 commit 8602268

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

.github/workflows/update-md-date.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff 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"

0 commit comments

Comments
 (0)