Skip to content

Stop the "tests" badge from failing on cancelled runs#409

Merged
yamcodes merged 1 commit intomainfrom
test-badge-not-red-on-cancelled
Nov 21, 2025
Merged

Stop the "tests" badge from failing on cancelled runs#409
yamcodes merged 1 commit intomainfrom
test-badge-not-red-on-cancelled

Conversation

@yamcodes
Copy link
Owner

@yamcodes yamcodes commented Nov 21, 2025

This is a hack to stop the "tests" badge from failing on cancelled runs by pointing it to a "mirror" workflow that succeeds when "test" is successful and fails when it does, but doesn't run when tests get cancelled.

Summary by CodeRabbit

  • Chores
    • Updated test workflow infrastructure and badge reporting system
    • Refreshed test status badge reference in documentation

✏️ Tip: You can customize this high-level summary in your review settings.

…update README.md to reflect new test badge URL.
@changeset-bot
Copy link

changeset-bot bot commented Nov 21, 2025

⚠️ No Changeset found

Latest commit: 9464766

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Nov 21, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
arkenv Ready Ready Preview Comment Nov 21, 2025 6:47pm

@github-actions github-actions bot added docs Improvements or additions to documentation arkenv Changes to the `arkenv` npm package. github actions Pull requests that update GitHub Actions code labels Nov 21, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 21, 2025

Walkthrough

Workflow renamed from "tests" to "test", a new badge-mirroring workflow introduced to report test status, and README documentation updated to reference the renamed workflow and new badge workflow.

Changes

Cohort / File(s) Summary
Workflow Rename & Badge Addition
.github/workflows/test.yml, .github/workflows/tests-badge.yml
Renamed workflow from "tests" to "test"; introduced new "tests-badge" workflow that mirrors test results on push to main, outputting success/failure badges
Documentation Update
packages/arkenv/README.md
Updated badge and workflow references to point to renamed "test" workflow and new "tests-badge" badge source

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor User
    User->>+GitHub: Push to main
    GitHub->>+test.yml: Trigger workflow
    test.yml->>-GitHub: Complete (success/failure)
    GitHub->>+tests-badge.yml: Trigger on workflow_run
    tests-badge.yml->>tests-badge.yml: Check if main push (not cancelled)
    alt Conclusion == success
        tests-badge.yml->>tests-badge.yml: Output green badge
    else Other conclusion
        tests-badge.yml->>tests-badge.yml: Output red badge + exit 1
    end
    tests-badge.yml->>-GitHub: Complete
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Straightforward workflow rename with minimal logic changes
  • New badge workflow follows a common pattern for workflow_run mirrors
  • README link updates are mechanical

Possibly related PRs

Suggested labels

github_actions, docs, arkenv

Poem

🐰 A workflow renamed, cleaner and neat,
A badge that reflects every test's heartbeat,
Green for success, red when things fall,
The mirror shines brightly—we test them all! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main objective of the PR: preventing the badge from showing failure status on cancelled test runs, which is the core change across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test-badge-not-red-on-cancelled

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 239f39f and 9464766.

📒 Files selected for processing (3)
  • .github/workflows/test.yml (1 hunks)
  • .github/workflows/tests-badge.yml (1 hunks)
  • packages/arkenv/README.md (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-09T17:37:19.650Z
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 132
File: packages/arkenv/README.md:13-14
Timestamp: 2025-09-09T17:37:19.650Z
Learning: For yamcodes/arkenv project: Runtime support documentation should link to specific examples: Node.js (examples/basic), Bun (examples/with-bun), Vite (examples/with-vite-react-ts).

Applied to files:

  • packages/arkenv/README.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test-e2e (e2e)
  • GitHub Check: test-e2e (a11y)
🔇 Additional comments (5)
packages/arkenv/README.md (1)

6-6: Badge and link references updated correctly.

The badge now points to tests-badge.yml (the mirroring workflow) while the href link points to test.yml (the actual test workflow). This aligns with the PR's architecture and ensures the badge displays the mirrored status while users can still inspect the underlying test workflow.

.github/workflows/test.yml (1)

1-1: Workflow rename is clean and non-breaking.

Renaming the workflow from "tests" to "test" is appropriate and maintains all triggering logic. The new "tests" workflow name is now free for the badge-mirroring workflow.

.github/workflows/tests-badge.yml (3)

11-14: Verify badge behavior when job condition prevents execution.

The mirror workflow's only job is guarded by a condition that will be false when tests are cancelled. This means the workflow will have no executing jobs. Please verify that when a workflow completes with all jobs skipped/excluded by conditions, the badge:

  1. Retains its previous status (doesn't reset to neutral/pending)
  2. Doesn't show a "skipped" state that could be misinterpreted

This is critical to ensure the PR's core objective—preventing red badges on cancelled runs—works as intended.


17-25: Mirror logic is sound; edge cases look handled.

The step correctly inspects the source workflow conclusion and mirrors it: on success the badge stays green (exit 0), on failure it turns red (exit 1). The conditions upstream ensure cancelled runs never reach this step, addressing the PR's core issue.


3-14: Property name verified as correct. The head_branch property is a documented property available in the github.event.workflow_run context, and it reliably contains the branch name. The workflow condition is correctly implemented.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@arkenv-bot
Copy link
Contributor

arkenv-bot bot commented Nov 21, 2025

📦 Bundle Size Report

Package Size Limit Diff Status
arkenv 729 B 2 kB 0.0%

All size limits passed!

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 21, 2025

Open in StackBlitz

npm i https://pkg.pr.new/arkenv@409
npm i https://pkg.pr.new/@arkenv/vite-plugin@409

commit: 9464766

@yamcodes yamcodes merged commit 3bfe709 into main Nov 21, 2025
19 checks passed
@yamcodes yamcodes deleted the test-badge-not-red-on-cancelled branch November 21, 2025 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arkenv Changes to the `arkenv` npm package. docs Improvements or additions to documentation github actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant