Skip to content

CI badge shows "failed" for cancelled builds #4047

@stephencelis

Description

@stephencelis

Describe the bug

If the most recent job for a runner was cancelled, the badge takes this as a "failed" job, but this doesn't really make sense. Jobs are often cancelled when multiple in-flight branches are merged. It would make more sense for the badge to always reflect the most recent, completed, non-cancelled job.

A big red "failed" at the top of a project's README can scare newcomers away from considering the project, so these temporary states could be harmful for adoption.

To Reproduce

  1. Have a repo with CI that auto-cancels jobs to prioritize the latest merge, and has a badge on the README.
  2. Open a couple PRs on the repo
  3. Merge one to start a job on main
  4. Merge another to cancel that job
  5. Observe the "failed" badge in the README as the second job is processed

Expected behavior

I expect canceled jobs to not be taken into account in the CI status.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions