badges / badges/shields

Badge for latest GitHub pre-release excluding later non-pre-release releases

Open
#7,913 7 comments 3 reactions 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
27.2k
Forks
5.6k
Avg merge
1d 8h
Merged PRs (30d)
46

Description

### Are you experiencing an issue with...

shields.io

### 🐞 Description

I asked on [StackOverflow](https://stackoverflow.com/questions/72063983/shields-io-badge-for-latest-github-pre-release-excluding-later-release) but no answer, if not appropriate to ask here, apologies, please redirect:

How can I create a badge that will display the latest pre-release version, excluding later releases that are not marked pre-release?

The current behavior allows for "inclusion" of a pre-release, but I want to explicitly only get the latest pre-release, ignoring any later releases that are not pre-release.

E.g.
```
![GitHub Latest Pre-Release)](https://img.shields.io/github/v/release/ptr727/PlexCleaner?include_prereleases&label=pre-release&logo=github)
![GitHub Latest Release)](https://img.shields.io/github/v/release/ptr727/PlexCleaner?logo=github)
```

From example [releases](https://github.com/ptr727/PlexCleaner/releases), expected that the badges list `2.7.11` as latest and `2.7.10-ga8a94550e6` as latest pre-release. (at time of writing).

Iterating over releases and finding pre-release by attribute seems [possible](https://stackoverflow.com/questions/67688662/how-can-i-get-the-latest-pre-release-release-for-my-github-repo-bash).

### 🔗 Link to the badge

![GitHub Latest Pre-Release)](https://img.shields.io/github/v/release/ptr727/PlexCleaner?include_prereleases&label=pre-release&logo=github)
![GitHub Latest Release)](https://img.shields.io/github/v/release/ptr727/PlexCleaner?logo=github)

### 💡 Possible Solution

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by locating the shields.io GitHub release badge endpoint and the release-selection logic that handles include_prereleases. Compare its result with the linked PlexCleaner releases; done means the badge reports the newest prerelease while ignoring later non-prerelease releases, without changing the latest-release badge.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, javascript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.