Skip to content

Commit f30cd76

Browse files
fix(mcp): match release-prod.yml fast-forward pattern
Checkout temp branch before fetching main:main to avoid "refusing to fetch into checked out branch" error. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent faf26f0 commit f30cd76

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

.github/workflows/release-mcp.yml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,27 +157,43 @@ jobs:
157157
cd packages/mcp
158158
npm publish --provenance --access public
159159
160-
- name: Push release commit to main
160+
- name: Checkout temporary branch
161+
env:
162+
TEMP_BRANCH: ${{ steps.push_temp_branch.outputs.temp_branch }}
163+
run: |
164+
git checkout "$TEMP_BRANCH"
165+
166+
- name: Fast-forward main to temporary branch
161167
env:
162168
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
169+
TEMP_BRANCH: ${{ steps.push_temp_branch.outputs.temp_branch }}
163170
run: |
164-
# Fetch latest main to check if fast-forward is possible
165-
git fetch origin main
171+
# Fetch main branch
172+
git fetch origin main:main
173+
git checkout main
166174
167-
# Check if fast-forward is possible (current HEAD must be ahead of origin/main)
168-
if ! git merge-base --is-ancestor origin/main HEAD; then
175+
# Check if fast-forward is possible
176+
if ! git merge-base --is-ancestor main "$TEMP_BRANCH"; then
169177
echo "❌ ERROR: Cannot fast-forward main branch to release commit"
170178
echo ""
171179
echo "This means new commits were pushed to main after the release process started."
172180
echo ""
173181
echo "Recent commits on main that caused the conflict:"
174-
git log --oneline HEAD..origin/main | head -5
182+
git log --oneline $TEMP_BRANCH..main | head -5
175183
exit 1
176184
fi
177185
178-
# Push current HEAD to main (fast-forward)
179-
git push origin HEAD:main
180-
echo "✓ Successfully pushed release commit to main"
186+
# Fast-forward main to release commit
187+
git merge --ff-only "$TEMP_BRANCH"
188+
189+
echo "✓ Successfully fast-forwarded main to release commit"
190+
191+
- name: Push main
192+
env:
193+
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
194+
run: |
195+
git push origin main
196+
echo "Pushed main branch"
181197
182198
- name: Delete temporary branch
183199
if: always()

0 commit comments

Comments
 (0)