-
Notifications
You must be signed in to change notification settings - Fork 6
remove constraint for True Tokenless #181
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,24 +45,22 @@ export const getPreSignedURL = async ({ | |
| }); | ||
|
|
||
| const requestBody: RequestBody = serviceParams; | ||
| /** | ||
| * We currently require the branch to be in the format `owner:branch` to identify that it is a | ||
| * proper tokenless upload. | ||
| * See: https://github.com/codecov/codecov-api/pull/741 | ||
| */ | ||
| if (!uploadToken && serviceParams.branch?.includes(":")) { | ||
| if (gitService) { | ||
| requestBody.git_service = gitService; | ||
| } else { | ||
| const foundGitService = findGitService(); | ||
| if (!foundGitService || foundGitService === "") { | ||
|
|
||
| if (gitService) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This gitService check is used to set the requestBody.git_service. However, what happens when the gitService isn't provided or found? Ensure fallback or error handling measures are in place. |
||
| requestBody.git_service = gitService; | ||
| } else { | ||
| const foundGitService = findGitService(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The findGitService function is called here if gitService is not provided. This is good since it provides a fallback for gitService. |
||
| if (!foundGitService || foundGitService === "" && !uploadToken) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This condition checks again if gitService exists. However, aren't we already in a code block where we know gitService doesn't exist? This check seems redundant and may lead to unnecessary computational costs. |
||
| /** | ||
| * gitService is required for tokenless upload. | ||
| */ | ||
| red("Failed to find git service for tokenless upload"); | ||
| throw new UndefinedGitServiceError("No upload token provided"); | ||
| } | ||
|
|
||
| requestBody.git_service = foundGitService; | ||
| } | ||
| } else if (oidc?.useGitHubOIDC && Core) { | ||
| } | ||
| if (oidc?.useGitHubOIDC && Core) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The condition 'oidc?.useGitHubOIDC && Core' is left unchanged but with updated indentation level. This alteration shows good git practice. However, its purpose isn't clear without context, make sure 'Core' is defined somewhere above the code block. If 'Core' is not defined elsewhere, there will be a reference error at runtime. |
||
| if (serviceParams?.service !== "github-actions") { | ||
| red("OIDC is only supported for GitHub Actions"); | ||
| throw new BadOIDCServiceError( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this condition means the format of the branch is no longer checked. Has the branch check been moved elsewhere, or is it no longer needed? If not necessary anymore, kindly disregard the comment.