fix: use repositoryUrl in GithubMetaAnalyzer#5622
fix: use repositoryUrl in GithubMetaAnalyzer#5622ShuP1 wants to merge 1 commit intoDependencyTrack:masterfrom
Conversation
Signed-off-by: May B. <clement.bois@orange.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where GithubMetaAnalyzer was not using the configured repositoryUrl when connecting anonymously to GitHub (i.e., when no credentials are provided). Previously, it would call GitHub.connectAnonymously() which always connects to the default GitHub.com, ignoring any custom GitHub Enterprise URL that may have been configured.
Key Changes:
- Changed anonymous GitHub connection to use
GitHub.connectToEnterpriseAnonymously(repositoryUrl)instead ofGitHub.connectAnonymously(), ensuring custom GitHub Enterprise URLs are respected even without credentials
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| github = GitHub.connectUsingOAuth(repositoryUrl, repositoryPassword); | ||
| } else { | ||
| github = GitHub.connectAnonymously(); | ||
| github = GitHub.connectToEnterpriseAnonymously(repositoryUrl); |
There was a problem hiding this comment.
This fix changes the behavior when connecting anonymously to use a custom repository URL instead of the default GitHub.com. However, there are no tests covering this scenario. Consider adding a test that verifies anonymous connections respect the custom repositoryUrl when set via setRepositoryBaseUrl(), similar to how ComposerMetaAnalyzerTest and NpmMetaAnalyzerTest test custom repository URLs.
Description
GithubMetaAnalyzershould userepositoryUrleven if no password is providedAddressed Issue
fixes #5621
Checklist