Skip to content

Use GitHub API to fetch latest release/version#1870

Merged
mikemhenry merged 4 commits intomainfrom
fix/issue_1869
Mar 10, 2026
Merged

Use GitHub API to fetch latest release/version#1870
mikemhenry merged 4 commits intomainfrom
fix/issue_1869

Conversation

@mikemhenry
Copy link
Contributor

Checklist

  • All new code is appropriately documented (user-facing code must have complete docstrings).
  • Added a news entry, or the changes are not user-facing.
  • Ran pre-commit: you can run pre-commit locally or comment on this PR with 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

@mikemhenry mikemhenry requested a review from atravitz March 10, 2026 19:12
@mikemhenry
Copy link
Contributor Author

I could use $REPO to make it easier to copy and paste into other repositories

@mikemhenry
Copy link
Contributor Author

If it works I will actually do that

@mikemhenry
Copy link
Contributor Author

@mikemhenry
Copy link
Contributor Author

@mikemhenry
Copy link
Contributor Author

@github-actions
Copy link

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 }}" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you using this instead of gh release list to avoid having to use gh?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the sake of mental exercise, gh, does have the --jq option! but I think the approach you did here is good.

Copy link
Contributor

@atravitz atravitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one non-blocking question

@mikemhenry mikemhenry merged commit d69baa6 into main Mar 10, 2026
9 checks passed
@mikemhenry mikemhenry deleted the fix/issue_1869 branch March 10, 2026 21:52
@codecov
Copy link

codecov bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.84%. Comparing base (031e13c) to head (6e26722).
⚠️ Report is 1 commits behind head on main.

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     
Flag Coverage Δ
fast-tests 91.84% <ø> (?)
slow-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants