scala-steward
scala-steward copied to clipboard
Changelog url is invalid
The link is good, but it points to a stale branch. Example PR here: https://github.com/disneystreaming/alloy/pull/84
This is because we use a hardcoded master and so if the branch still exist on the repo, the url is valid and so it's displayed:
val maybeSegments = repoForgeType.collect {
case GitHub | GitLab => List("blob", "master")
case Bitbucket => List("master")
case BitbucketServer => List("browse")
case Gitea => List("src", "branch", "master")
}
There are different solutions:
- [Delete the branch] on the repo in question, the downside is that, as far as I understand the source, we will loose the link to the changelog.md file
- Implement fix scala-steward where we retrieve the default branch for a repo before we generate the urls
I use ChatGPT (I'm still impressed to generate an example curl command on how to do this):
bitbucket:
default_branch=$(curl -s https://api.bitbucket.org/2.0/repositories/${username}/${repository} | jq -r '.mainbranch.name')
github:
default_branch=$(curl -s https://api.github.com/repos/${username}/${repository} | jq -r '.default_branch')
gitea:
default_branch=$(curl -s "${gitea_host}/api/v1/repos/${username}/${repository}" | jq -r '.default_branch')
All 3 works without auth on public repo, I'd need to play a bit more with it for private repository / server.