Skip to content

chore(server): use lib to call GitHub to list available versions #1920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

LeoColman
Copy link
Member

  • Replace manual HTTP client implementation with kohsuke.github library.
  • Simplify fetchAvailableVersions logic and remove redundant dependencies.
  • Refactor tests to use kotest with MockServer for more concise and structured testing.
  • Update dependencies and remove unused code.

@LeoColman LeoColman requested a review from krzema12 April 25, 2025 23:08
@LeoColman LeoColman force-pushed the 1884-use-a-lib-to-interact-with-github branch 2 times, most recently from 0b3a860 to d733110 Compare April 25, 2025 23:27
@LeoColman LeoColman linked an issue Apr 26, 2025 that may be closed by this pull request
3 tasks
@LeoColman LeoColman force-pushed the 1884-use-a-lib-to-interact-with-github branch 2 times, most recently from 6268bad to 9a774c9 Compare May 12, 2025 18:09
@krzema12
Copy link
Member

@LeoColman could you resolve conflicts?

@LeoColman LeoColman force-pushed the 1884-use-a-lib-to-interact-with-github branch from 9a774c9 to 0766641 Compare May 14, 2025 21:22
@LeoColman
Copy link
Member Author

@krzema12 Done

@krzema12
Copy link
Member

The tests are failing, let me know if you need help figuring out why.

- Replace manual HTTP client implementation with `kohsuke.github`
library.
- Simplify `fetchAvailableVersions` logic and remove redundant
dependencies.
- Refactor tests to use `kotest` with `MockServer` for more concise and
structured testing.
- Update dependencies and remove unused code.
@LeoColman LeoColman force-pushed the 1884-use-a-lib-to-interact-with-github branch from bd7013e to 4a918ee Compare May 16, 2025 00:51
@krzema12
Copy link
Member

Let me take it from here, thank you 🙇

@krzema12 krzema12 changed the title refactor(server): simplify GitHub API usage chore(server): use lib to call GitHub in some use cases May 17, 2025
@krzema12 krzema12 changed the title chore(server): use lib to call GitHub in some use cases chore(server): use lib to call GitHub to list available versions May 17, 2025
}
}.build()
val repository = github.getRepository("$owner/$name")
val apiTags = repository.getRefs("tags").refsStartingWithV().map { Version(it) }
Copy link
Member

Choose a reason for hiding this comment

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

FTR, it turned out that the lib doesn't support matching-refs API: https://docs.github.com/en/rest/git/refs?apiVersion=2022-11-28#list-matching-references. Even though it's easy to emulate, I'd like to try staying with it. I'll thus look at contributing support for it to the lib.

response.body()
}
}.build()
val repository = github.getRepository("$owner/$name")
Copy link
Member

Choose a reason for hiding this comment

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

FTR, it turned out that merely getting a reference to a repo makes another API call. I don't like it. I'll see how easy it is to disable this behavior in the lib.

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.

Use a lib to interact with GitHub
2 participants