Skip to content

Commit e053a7c

Browse files
Timna BrownTimna Brown
authored andcommitted
fix: stash local changes before branch checkout to prevent overwrite error
1 parent 884d7aa commit e053a7c

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

.github/workflows/use-visitor-counter.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ jobs:
6363
TOKEN: ${{ secrets.GITHUB_TOKEN }}
6464
run: |
6565
git fetch origin
66+
git stash --include-untracked
6667
git checkout -b ${{ github.event.pull_request.head.ref }} origin/${{ github.event.pull_request.head.ref }}
68+
git stash pop
6769
git add "*.md" metrics.json
6870
git commit -m "Update visitor count" || echo "No changes to commit"
6971
git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }}
@@ -76,7 +78,9 @@ jobs:
7678
TOKEN: ${{ secrets.GITHUB_TOKEN }}
7779
run: |
7880
git fetch origin
81+
git stash --include-untracked
7982
git checkout ${{ github.event.pull_request.head.ref }} || git checkout -b ${{ github.event.pull_request.head.ref }} origin/${{ github.event.pull_request.head.ref }}
83+
git stash pop
8084
git add "*.md" metrics.json
8185
git commit -m "Update visitor count" || echo "No changes to commit"
8286
git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }}

0 commit comments

Comments
 (0)