Skip to content

fix(badge): read workflow status from the default branch when no branch is set - #504

Merged
vite-hub[bot] merged 3 commits into
mainfrom
fix/badge-default-branch
Nov 28, 2026
Merged

vite-hub[bot] merged 3 commits into
mainfrom
fix/badge-default-branch

Conversation

@onmax

@onmax onmax commented Nov 28, 2026

Copy link
Copy Markdown
Owner

The README's build badge reads skipped, even though every recent release.yaml run on main passed.

When a badge has no branch, the resolver showed the latest finished run from any branch. release.yaml also runs on pull_request: closed, and when the merged PR isn't a release PR it skips every job. So after each normal merge, the newest run is a skipped one from a feature branch:

Latest release.yaml runs Conclusion
pull_request on feat/social-conversation skipped ← badge
push on main success
push on main success

The badge now picks a run the way GitHub's own badge does: the latest finished run on the default branch, or on any branch when the workflow never runs on the default branch (a workflow that only runs on PRs, such as pkg-pr-new.yml). An explicit branch works as before.

That costs one extra GitHub call, the repository, which is cached with the result for 60 seconds. With a token, that call also returns early for a repository that isn't public, so the default branch name of a private repository never decides anything.

The same fix applies to other READMEs using this badge without branch: onmax/tiny reads skipped now, and onmax/fleetrc would after its next merge. None of them need changes.

  • New test: without a branch, the badge shows main's passing run instead of a newer skipped run from another branch. It fails on the old resolver.
  • New test: a workflow with no runs on the default branch falls back to any branch.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-28T16:05:39.951501Z
We couldn’t complete this review. Comment @codex review to try again.
f4ee29d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@pkg-pr-new

pkg-pr-new Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

comark-annotate

pnpm add https://pkg.pr.new/comark-annotate@504

comark-badge

pnpm add https://pkg.pr.new/comark-badge@504

comark-bundle

pnpm add https://pkg.pr.new/comark-bundle@504

comark-cards

pnpm add https://pkg.pr.new/comark-cards@504

comark-carousel

pnpm add https://pkg.pr.new/comark-carousel@504

comark-cast

pnpm add https://pkg.pr.new/comark-cast@504

comark-charts

pnpm add https://pkg.pr.new/comark-charts@504

comark-chat

pnpm add https://pkg.pr.new/comark-chat@504

comark-chips

pnpm add https://pkg.pr.new/comark-chips@504

comark-cjk

pnpm add https://pkg.pr.new/comark-cjk@504

comark-code

pnpm add https://pkg.pr.new/comark-code@504

comark-code-notes

pnpm add https://pkg.pr.new/comark-code-notes@504

comark-colors

pnpm add https://pkg.pr.new/comark-colors@504

comark-comments

pnpm add https://pkg.pr.new/comark-comments@504

comark-critic

pnpm add https://pkg.pr.new/comark-critic@504

comark-deflist

pnpm add https://pkg.pr.new/comark-deflist@504

comark-details

pnpm add https://pkg.pr.new/comark-details@504

comark-diagrams

pnpm add https://pkg.pr.new/comark-diagrams@504

comark-diff

pnpm add https://pkg.pr.new/comark-diff@504

comark-embed

pnpm add https://pkg.pr.new/comark-embed@504

comark-fields

pnpm add https://pkg.pr.new/comark-fields@504

comark-figure

pnpm add https://pkg.pr.new/comark-figure@504

comark-file-tree

pnpm add https://pkg.pr.new/comark-file-tree@504

comark-footnotes

pnpm add https://pkg.pr.new/comark-footnotes@504

comark-git-graph

pnpm add https://pkg.pr.new/comark-git-graph@504

comark-github

pnpm add https://pkg.pr.new/comark-github@504

comark-icon

pnpm add https://pkg.pr.new/comark-icon@504

comark-include

pnpm add https://pkg.pr.new/comark-include@504

comark-keys

pnpm add https://pkg.pr.new/comark-keys@504

comark-links

pnpm add https://pkg.pr.new/comark-links@504

comark-linter

pnpm add https://pkg.pr.new/comark-linter@504

comark-magic-move

pnpm add https://pkg.pr.new/comark-magic-move@504

comark-mark

pnpm add https://pkg.pr.new/comark-mark@504

markdown-it-to-comark

pnpm add https://pkg.pr.new/markdown-it-to-comark@504

marked-to-comark

pnpm add https://pkg.pr.new/marked-to-comark@504

comark-mathml

pnpm add https://pkg.pr.new/comark-mathml@504

comark-media

pnpm add https://pkg.pr.new/comark-media@504

comark-metrics

pnpm add https://pkg.pr.new/comark-metrics@504

migrate-to-comark

pnpm add https://pkg.pr.new/migrate-to-comark@504

comark-motion

pnpm add https://pkg.pr.new/comark-motion@504

comark-outline

pnpm add https://pkg.pr.new/comark-outline@504

comark-properties

pnpm add https://pkg.pr.new/comark-properties@504

comark-qr

pnpm add https://pkg.pr.new/comark-qr@504

comark-quiz

pnpm add https://pkg.pr.new/comark-quiz@504

comark-reading-time

pnpm add https://pkg.pr.new/comark-reading-time@504

remark-to-comark

pnpm add https://pkg.pr.new/remark-to-comark@504

comark-social

pnpm add https://pkg.pr.new/comark-social@504

comark-sources

pnpm add https://pkg.pr.new/comark-sources@504

comark-steps

pnpm add https://pkg.pr.new/comark-steps@504

comark-table

pnpm add https://pkg.pr.new/comark-table@504

comark-tabs

pnpm add https://pkg.pr.new/comark-tabs@504

comark-tests

pnpm add https://pkg.pr.new/comark-tests@504

comark-time

pnpm add https://pkg.pr.new/comark-time@504

comark-ui

pnpm add https://pkg.pr.new/comark-ui@504

comark-xref

pnpm add https://pkg.pr.new/comark-xref@504

comark-zoom

pnpm add https://pkg.pr.new/comark-zoom@504

commit: 1c216de

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

A fork branch named main can still override the upstream workflow badge, and the new repository lookup breaks an existing CI test.

Approach: Resolving the default branch in the shared badge resolver is the right place for the fix, but a completed run with a matching branch name is not necessarily a run on the upstream default branch.

Reviewed changes across the badge resolver, its consumers, and its tests:

  • Workflow selection: Without branch, the resolver fetches repository metadata and tries the default branch before falling back to all branches. Explicit branches keep the previous query.
  • Public visibility: Authenticated requests check repository metadata before looking up runs and retain the selected run’s visibility check.
  • Docs and coverage: The PR updates the badge docs and editor metadata and adds tests for branch priority and fallback. The workspace build and all 65 badge tests passed; the docs parser integration suite had one failure.

⚠️ The static badge download test fails

P2 · Class: stale GitHub response fixture. The docs parser integration still responds to every GitHub request with workflow_runs JSON. The new repository lookup needs default_branch, so the renderer leaves a hosted badge URL in the HTML and the existing static-download assertion fails in pnpm test.

Technical details
# Fix the repository response fixture

## Affected sites
- [packages/ui/test/browser-plugins.test.ts:13–20](https://github.com/onmax/comark-ui/blob/f4ee29d433814bd57a9e138b4d9b54a832ed92e5/packages/ui/test/browser-plugins.test.ts#L13-L20) — the mock does not distinguish the repository endpoint from the workflow-runs endpoint.
- [packages/ui/test/browser-plugins.test.ts:39–44](https://github.com/onmax/comark-ui/blob/f4ee29d433814bd57a9e138b4d9b54a832ed92e5/packages/ui/test/browser-plugins.test.ts#L39-L44) — reproduced the failure at line 43 after building the workspace and running docs prepare.

## Required outcome
- Stub repository metadata and workflow runs separately so the test still verifies that the static render embeds the badge rather than falling back to its hosted URL.

ℹ️ The badge builder and skill still promise all-branch results

P2 · Class: stale branch-default guidance. The builder’s empty branch field says All branches, and the bundled agent reference says omitting branch returns the latest run across branches. Both can lead users and agents to omit branch expecting a result that the new resolver won’t select.

Technical details
# Keep branch guidance consistent

## Affected sites
- [docs/badges/index.html:65–68](https://github.com/onmax/comark-ui/blob/f4ee29d433814bd57a9e138b4d9b54a832ed92e5/docs/badges/index.html#L65-L68) — the empty input says `All branches`.
- [skills/comark-ui/references/badge.md:38](https://github.com/onmax/comark-ui/blob/f4ee29d433814bd57a9e138b4d9b54a832ed92e5/skills/comark-ui/references/badge.md#L38) — the shipped reference promises an unfiltered lookup.

## Required outcome
- Explain that an omitted branch prefers the repository’s default branch and only falls back across branches under the documented condition.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.2-sol(high) | 𝕏

Comment thread packages/badge/src/live.ts Resolved
@vite-hub

vite-hub Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed Not started —
View session Completed 2026-11-28T18:27:55.335Z 4m 24s
View session Waiting 2026-11-28T18:13:14.497Z 2m 14s
View session Completed 2026-11-28T17:35:44.533Z 14m 22s

Latest result

Pull request merged.

Final answers

Session

Pull request merged.

View session

Pushed 1c216de to fix the P1 badge regression and resolved the review thread. Five-run default-branch pages now have a 320 KiB cap; other responses retain the 64 KiB limit. All 69 badge tests passed, including both response-size cases. Repository lint exited successfully with warnings. Hosted checks are pending.

View session

CI reconciliation completed; model work is waiting for host admission.

View session

Pushed 9eaa78b and resolved the P1 review thread. The badge now distinguishes upstream default-branch runs from same-name forks and won’t fall back while the first upstream run is in progress. Fixed both P2 findings: the stale CI fixture and misleading branch guidance. All 104 focused tests passed, and lint passed with warnings outside the changed files. Awaiting hosted checks.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The new five-run query can make a passing workflow badge show unavailable when branch is omitted.

Approach: Checking run ownership and status fixes the previous selection logic, but the new page size exceeds the existing response limit for some ordinary GitHub responses.

Reviewed changes in 9eaa78b7 since the previous review. All 104 focused badge and browser plugin tests passed; live GitHub responses exposed the regression below.

  • Distinguished upstream runs: Checked the head repository while paging and separated a first in-progress default-branch run from a workflow with no upstream runs.
  • Updated coverage and guidance: Fixed the static-download fixture, added handler tests for fork and in-progress runs, and updated the badge builder and bundled skill.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.2-sol(high) | 𝕏

Comment thread packages/badge/src/live.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found. No P0 or P1 findings remain.

Reviewed changes in 1c216de8 since the prior Pullfrog review. All 69 badge tests passed, and both previously failing live GitHub workflows now render passing without an explicit branch.

  • Raised the response limit for workflow pages: Increased the limit to 320 KiB for five-run default-branch pages while keeping the 64 KiB limit for other requests.
  • Added handler coverage: Verified that a realistic page above the old limit renders correctly and that a page above the new limit is still rejected.

Pullfrog  | View workflow run | Using gpt-6.2-sol(high) | 𝕏

@vite-hub
vite-hub Bot merged commit e621d54 into main Nov 28, 2026
7 checks passed
@vite-hub
vite-hub Bot deleted the fix/badge-default-branch branch November 28, 2026 18:46
@github-actions github-actions Bot mentioned this pull request Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant