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

EMISSINGREPO when GITHUB_API_URL ends with a trailing slash since v10 #838

Closed
enolive opened this issue May 21, 2024 · 2 comments · Fixed by #839
Closed

EMISSINGREPO when GITHUB_API_URL ends with a trailing slash since v10 #838

enolive opened this issue May 21, 2024 · 2 comments · Fixed by #839

Comments

@enolive
Copy link

enolive commented May 21, 2024

I use this plugin in an enterprise environment for my customer.

I noticed that version v10.0.4 which is included in semantic-release >= 23.0.2 has a different behavior regarding a trailing slash

config anonymized:

GITHUB_API_URL=https://acme.org/api/v3/

error log anonymized:

12:06:18  [12:06:17 PM] [semantic-release] › ✘  EMISSINGREPO The repository my-department/my-repo doesn't exist.
12:06:18  The semantic-release repositoryUrl option must refer to your GitHub repository. The repository must be accessible with the GitHub API (https://developer.github.com/v3).

If I remove the trailing slash from the environment variable, everything works fine again.

As I feel trailing slashes in URLs are a common pitfall I'd appreciate a solution that normalizes the API URL. Especially because the behavior prior to 10.0.4 was different

@gr2m
Copy link
Member

gr2m commented May 21, 2024

This might be a regression introduced in #829 @fgreinacher

We wrap this value into a method that removes a trailing / from the string:
https://github.com/semantic-release/github/pull/829/files#diff-3c41bd6e7d07732417abb44146ae10fa613e5d61d5df96d088e44cb8d5dc557fR29

But isn't GITHUB_API_URL set by GitHub itself in GitHub Actions? Or are you setting the variable in your own environment?

@fgreinacher
Copy link
Contributor

fgreinacher commented May 21, 2024

This might be a regression introduced in #829 @fgreinacher

Indeed this happens because gitHubApiUrl (unlike gitHubUrl) is not passed through parseUrl which seems to also remove trailing slashes. I think we should add this to bring back previous behavior. If you agree I'll be happy to send a PR.

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 a pull request may close this issue.

3 participants