Skip to content
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

Changelog url is invalid #3043

Open
daddykotex opened this issue May 1, 2023 · 1 comment
Open

Changelog url is invalid #3043

daddykotex opened this issue May 1, 2023 · 1 comment

Comments

@daddykotex
Copy link
Contributor

The link is good, but it points to a stale branch. Example PR here: disneystreaming/alloy#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:

  1. [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
  2. Implement fix scala-steward where we retrieve the default branch for a repo before we generate the urls
@daddykotex
Copy link
Contributor Author

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.

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

No branches or pull requests

1 participant