Use GitHub API to fetch latest release/version#1870
Conversation
|
I could use |
|
If it works I will actually do that |
|
testing here testing here https://github.com/OpenFreeEnergy/openfe/actions/runs/22920034257 |
|
testing update version here: https://github.com/OpenFreeEnergy/openfe/actions/runs/22920555651 |
|
testing version with auth |
|
No API break detected ✅ |
| # slice off the v, ie v0.7.2 -> 0.7.2 | ||
| VERSION=${LATEST_TAG:1} | ||
| REPO="${{ github.repository }}" | ||
| VERSION=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ |
There was a problem hiding this comment.
are you using this instead of gh release list to avoid having to use gh?
There was a problem hiding this comment.
I wasn't sure if gh would be on the runners. I just looked at using gh release list and it would require a bit more work since it doesn't look like there is a way to just fetch the latest, but instead isLatest so it would take some extra filtering:
$ gh release list --json isLatest,tagName
[
{
"isLatest": false,
"tagName": "v1.9.1dev0"
},
{
"isLatest": true,
"tagName": "v1.9.1"
},
{
"isLatest": false,
"tagName": "v1.9.0"
}
]
Instead, here we are leveraging the latest api end point. Also if you ever want to use this, you don't need the auth headers, just included that to avoid rate limiting:
curl -s https://api.github.com/repos/OpenFreeEnergy/openfe/releases/latest | jq -r '.tag_name | ltrimstr("v")'
There was a problem hiding this comment.
for the sake of mental exercise, gh, does have the --jq option! but I think the approach you did here is good.
atravitz
left a comment
There was a problem hiding this comment.
one non-blocking question
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1870 +/- ##
==========================================
- Coverage 94.79% 91.84% -2.95%
==========================================
Files 205 205
Lines 17957 17957
==========================================
- Hits 17022 16493 -529
- Misses 935 1464 +529
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Checklist
newsentry, or the changes are not user-facing.pre-commit.ci autofix.Manual Tests: these are slow so don't need to be run every commit, only before merging and when relevant changes are made (generally at reviewer-discretion).
Developers certificate of origin
fixes issue conda cron searching for dev version #1869