Skip to content

Commit 7262306

Browse files
committed
fix: 修复工作路分支异常,暂存问题
1 parent 85ce07f commit 7262306

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

.github/workflows/auto-changelog.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,21 @@ jobs:
5858
echo 'Preview:'
5959
grep -n "^${{ steps.detect.outputs.version }}$" -A12 docs/change_log.md || true
6060
61-
- name: Commit changes
61+
- name: Stage changes
6262
if: ${{ steps.detect.outputs.update == 'true' }}
6363
run: |
6464
set -e
65-
git config user.name 'github-actions[bot]'
66-
git config user.email 'github-actions[bot]@users.noreply.github.com'
67-
branch="chore/changelog-${{ steps.detect.outputs.version }}"
65+
# Ensure we are on the correct base branch before staging
6866
base="${{ steps.detect.outputs.base }}"
67+
git checkout -B "$base" "origin/$base"
6968
70-
# Create new branch from remote base
71-
git checkout -b "$branch" "origin/$base"
69+
# Run generation again to ensure file is updated in the correct branch context if needed
70+
# (Optional, but safe if the previous step modified a file in a detached head or different branch)
71+
python .github/scripts/gen_changelog.py "${{ steps.detect.outputs.version }}"
7272
73+
git config user.name 'github-actions[bot]'
74+
git config user.email 'github-actions[bot]@users.noreply.github.com'
7375
git add docs/change_log.md
74-
git commit -m "chore: add changelog for ${{ steps.detect.outputs.version }}"
7576
7677
- name: Create Pull Request
7778
if: ${{ steps.detect.outputs.update == 'true' }}

0 commit comments

Comments
 (0)