mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
Fix git push issue in changelog workflow
- Properly determine PR branch name and repository owner - Use correct git push syntax for detached HEAD state - Handle forked repositories gracefully - Add proper error handling for push operations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
ae8171e9fe
commit
73ade6e94f
1 changed files with 25 additions and 1 deletions
26
.github/workflows/changelog-v3.yml
vendored
26
.github/workflows/changelog-v3.yml
vendored
|
|
@ -101,12 +101,36 @@ jobs:
|
|||
echo "No changes to commit"
|
||||
echo "committed=false" >> $GITHUB_OUTPUT
|
||||
else
|
||||
# Get the correct branch name to push to
|
||||
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
|
||||
REPO_OWNER="${{ github.event.pull_request.head.repo.owner.login }}"
|
||||
else
|
||||
# For manual workflow dispatch, get PR info
|
||||
PR_INFO=$(gh pr view ${{ steps.pr_info.outputs.pr_number }} --json headRefName,headRepository)
|
||||
BRANCH_NAME=$(echo "$PR_INFO" | jq -r '.headRefName')
|
||||
REPO_OWNER=$(echo "$PR_INFO" | jq -r '.headRepository.owner.login')
|
||||
fi
|
||||
|
||||
echo "Pushing to branch: $BRANCH_NAME in repo: $REPO_OWNER"
|
||||
|
||||
git add docs/src/content/docs/changelog.mdx
|
||||
git commit -m "🤖 Fix changelog: move entries to Unreleased section"
|
||||
git push origin HEAD
|
||||
|
||||
# Push to the correct PR branch
|
||||
if [ "$REPO_OWNER" = "wailsapp" ]; then
|
||||
git push origin HEAD:$BRANCH_NAME
|
||||
else
|
||||
echo "⚠️ Cannot push to forked repository. Manual fix required."
|
||||
echo "committed=false" >> $GITHUB_OUTPUT
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "committed=true" >> $GITHUB_OUTPUT
|
||||
echo "✅ Changes committed and pushed"
|
||||
fi
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Comment on PR
|
||||
if: steps.validate.outputs.result && github.event.inputs.pr_number
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue