diff --git a/.github/workflows/auto-changelog.yml b/.github/workflows/auto-changelog.yml index 4906be46..624c85fe 100644 --- a/.github/workflows/auto-changelog.yml +++ b/.github/workflows/auto-changelog.yml @@ -42,7 +42,8 @@ jobs: echo "base=$base_branch" >> $GITHUB_OUTPUT exit 0 fi - git checkout "$base_branch" + # Force checkout of remote branch to avoid tag ambiguity and ensure correct base + git checkout -B "$base_branch" "origin/$base_branch" if grep -q "^$version$" docs/change_log.md; then echo "Already present in changelog."; upd=false else @@ -59,12 +60,16 @@ jobs: echo 'Preview:' grep -n "^${{ steps.detect.outputs.version }}$" -A12 docs/change_log.md || true - - name: Stage changes + - name: Commit changes if: ${{ steps.detect.outputs.update == 'true' }} run: | + set -e git config user.name 'github-actions[bot]' git config user.email 'github-actions[bot]@users.noreply.github.com' + branch=chore/changelog-${{ steps.detect.outputs.version }} + git checkout -B "$branch" git add docs/change_log.md + git commit -m "chore: add changelog for ${{ steps.detect.outputs.version }}" - name: Create Pull Request if: ${{ steps.detect.outputs.update == 'true' }}