Skip to content

Commit 76a8210

Browse files
authored
fix: filter out prereleases when getting the latest release (#2588)
<!-- ☝️ 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? -->
1 parent cfec8f3 commit 76a8210

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

server/api/getLatestRelease.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ export default defineEventHandler(async () => {
99
# eslint-disable-next-line @graphql-eslint/fields-on-correct-type
1010
repository(owner: "JabRef", name: "jabref") {
1111
releases(
12-
first: 1
12+
first: 5
1313
orderBy: { field: CREATED_AT, direction: DESC }
1414
) {
1515
nodes {
1616
tagName
17+
isPrerelease
1718
}
1819
}
1920
}
@@ -27,15 +28,15 @@ export default defineEventHandler(async () => {
2728
releases?: {
2829
nodes: {
2930
tagName: string
31+
isPrerelease: boolean
3032
}[]
3133
}
3234
}
3335
}
3436
}
3537
return {
36-
version: response.data?.repository?.releases?.nodes[0].tagName.replace(
37-
'v',
38-
'',
39-
), // something like 5.7
38+
version: response.data?.repository?.releases?.nodes
39+
.find((release) => !release.isPrerelease)
40+
?.tagName.replace('v', ''), // something like 5.7
4041
}
4142
})

0 commit comments

Comments
 (0)