Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions packages/bundler-plugin-core/src/utils/getPreSignedURL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(":")) {
Copy link

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.

if (gitService) {
requestBody.git_service = gitService;
} else {
const foundGitService = findGitService();
if (!foundGitService || foundGitService === "") {

if (gitService) {
Copy link

Choose a reason for hiding this comment

The 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();
Copy link

Choose a reason for hiding this comment

The 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) {
Copy link

Choose a reason for hiding this comment

The 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) {
Copy link

Choose a reason for hiding this comment

The 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(
Expand Down
Loading