Skip to content

Commit 0a89a12

Browse files
authored
change logic around
1 parent 2725c9f commit 0a89a12

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

packages/bundler-plugin-core/src/utils/getPreSignedURL.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,22 @@ export const getPreSignedURL = async ({
4545
});
4646

4747
const requestBody: RequestBody = serviceParams;
48-
/**
49-
* We currently require the branch to be in the format `owner:branch` to identify that it is a
50-
* proper tokenless upload.
51-
* See: https://github.com/codecov/codecov-api/pull/741
52-
*/
53-
if (!uploadToken) {
54-
if (gitService) {
55-
requestBody.git_service = gitService;
56-
} else {
57-
const foundGitService = findGitService();
58-
if (!foundGitService || foundGitService === "") {
48+
49+
if (gitService) {
50+
requestBody.git_service = gitService;
51+
} else {
52+
const foundGitService = findGitService();
53+
if (!foundGitService || foundGitService === "" && !uploadToken) {
54+
/**
55+
* gitService is required for tokenless upload.
56+
*/
5957
red("Failed to find git service for tokenless upload");
6058
throw new UndefinedGitServiceError("No upload token provided");
6159
}
6260

6361
requestBody.git_service = foundGitService;
64-
}
65-
} else if (oidc?.useGitHubOIDC && Core) {
62+
}
63+
if (oidc?.useGitHubOIDC && Core) {
6664
if (serviceParams?.service !== "github-actions") {
6765
red("OIDC is only supported for GitHub Actions");
6866
throw new BadOIDCServiceError(

0 commit comments

Comments
 (0)