Skip to content

Commit

Permalink
fix: filter out prereleases when getting the latest release (#2588)
Browse files Browse the repository at this point in the history
<!--
☝️ PR title should follow conventional commits
(https://conventionalcommits.org).
In particular, the title should start with one of the following types:

- docs: 📖 Documentation (updates to the documentation or readme)
- fix: 🐞 Bug fix (a non-breaking change that fixes an issue)
- feat: ✨ New feature/enhancement (a non-breaking change that adds
functionality or improves existing one)
- feat!/fix!: ⚠️ Breaking change (fix or feature that would cause
existing functionality to change)
- chore: 🧹 Chore (updates to the build process or auxiliary tools and
libraries)
-->

### 🔗 Linked issue

<!-- If it resolves an open issue, please link the issue here. For
example "Resolves #123" -->

### 📚 Description

<!-- Describe your changes in detail -->
<!-- Why is this change required? What problem does it solve? -->
  • Loading branch information
tobiasdiez authored Dec 25, 2024
1 parent cfec8f3 commit 76a8210
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions server/api/getLatestRelease.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ export default defineEventHandler(async () => {
# eslint-disable-next-line @graphql-eslint/fields-on-correct-type
repository(owner: "JabRef", name: "jabref") {
releases(
first: 1
first: 5
orderBy: { field: CREATED_AT, direction: DESC }
) {
nodes {
tagName
isPrerelease
}
}
}
Expand All @@ -27,15 +28,15 @@ export default defineEventHandler(async () => {
releases?: {
nodes: {
tagName: string
isPrerelease: boolean
}[]
}
}
}
}
return {
version: response.data?.repository?.releases?.nodes[0].tagName.replace(
'v',
'',
), // something like 5.7
version: response.data?.repository?.releases?.nodes
.find((release) => !release.isPrerelease)
?.tagName.replace('v', ''), // something like 5.7
}
})

0 comments on commit 76a8210

Please sign in to comment.