build: fix markdown_equations push failure when PR branch exists#13110
Draft
Planeshifter wants to merge 1 commit into
Draft
build: fix markdown_equations push failure when PR branch exists#13110Planeshifter wants to merge 1 commit into
Planeshifter wants to merge 1 commit into
Conversation
The `markdown_equations` CI workflow commits SVG and element changes to the local checkout of `develop`, then uses `peter-evans/create-pull-request` to push those commits to the `markdown-insert-equations` branch. The prior shallow clone only fetches `develop`; the `markdown-insert-equations` branch is never fetched, so no local tracking reference exists for it. When peter-evans calls `git push --force-with-lease`, git cannot verify the expected remote state and rejects the push with "error: failed to push some refs". Fix: fetch `markdown-insert-equations` before the delete step so the tracking reference is established. If the branch exists and the delete succeeds, peter-evans creates it fresh (no force-with-lease concern). If the delete fails (e.g. permissions), the tracking reference lets force-with-lease verify the remote state and the push succeeds. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JxM7pSh76qaHqGoSgENEda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves N/A — automated CI fix; no tracking issue.
Description
This pull request:
markdown_equationsscheduled workflow wherepeter-evans/create-pull-requestproduceserror: failed to push some refswhen themarkdown-insert-equationsbranch already exists on the remote.Root cause. The workflow's shallow clone (
fetch-depth: 100) only fetches thedevelopbranch. Themarkdown-insert-equationsbranch is never fetched, so no local tracking reference exists for it. When peter-evans internally callsgit push --force-with-lease origin markdown-insert-equations, git cannot verify the expected remote state against a missing tracking ref and rejects the push.Fix. A single
git fetch origin markdown-insert-equations 2>/dev/null || trueis added at the top of the "Delete remote PR branch" step, immediately before the API delete call. This establishes the tracking reference before peter-evans runs. Two outcomes:Related Issues
This pull request has the following related issues:
Questions
No.
Other
The workflow has failed on 14 of 15 runs in the past 30 days. The one success (2026-06-19) was likely a run where the
markdown-insert-equationsbranch did not yet exist at push time.The
git commitcalls in the "Generate SVG equations" and "Update equation elements" steps are intentionally preserved: theremark-img-equations-src-urlsremark plugin callsgit rev-list -1 HEAD <svg-file>to obtain a commit SHA for building jsdelivr URLs, so the SVG files must be committed before that plugin runs.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written primarily by Claude Code as part of an automated CI failure investigation routine. The root-cause analysis (shallow-clone missing the PR branch → missing
--force-with-leasetracking ref) and the fix (addinggit fetch) were generated and validated by Claude Code. A human operator reviewed the final diff before merge.@stdlib-js/reviewers
Generated by Claude Code