Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,20 @@ private AskRequest buildAskRequest(
}
} else if (vcsConnection.getConnectionType() == EVcsConnectionType.APP) {
accessToken = tokenEncryptionService.decrypt(vcsConnection.getAccessToken());
} else if (vcsConnection.getConnectionType() == EVcsConnectionType.PERSONAL_TOKEN ||
vcsConnection.getConnectionType() == EVcsConnectionType.REPOSITORY_TOKEN) {
// For GitLab personal/repository tokens, get the token from config
if (vcsConnection.getConfiguration() instanceof org.rostilos.codecrow.core.model.vcs.config.gitlab.GitLabConfig gitLabConfig) {
accessToken = gitLabConfig.accessToken();
}
}

// Determine VCS provider string
String vcsProvider = vcsConnection.getProviderType() == EVcsProvider.GITHUB
? "github"
: "bitbucket_cloud";
String vcsProvider = switch (vcsConnection.getProviderType()) {
case GITHUB -> "github";
case GITLAB -> "gitlab";
default -> "bitbucket_cloud";
};

// Build analysis context string
String analysisContext = contextData.analysisInfo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,20 @@ private ReviewRequest buildReviewRequest(Project project, WebhookPayload payload
}
} else if (vcsConnection.getConnectionType() == EVcsConnectionType.APP) {
accessToken = tokenEncryptionService.decrypt(vcsConnection.getAccessToken());
} else if (vcsConnection.getConnectionType() == EVcsConnectionType.PERSONAL_TOKEN ||
vcsConnection.getConnectionType() == EVcsConnectionType.REPOSITORY_TOKEN) {
// For GitLab personal/repository tokens, get the token from config
if (vcsConnection.getConfiguration() instanceof org.rostilos.codecrow.core.model.vcs.config.gitlab.GitLabConfig gitLabConfig) {
accessToken = gitLabConfig.accessToken();
}
}

// Determine VCS provider string
String vcsProvider = vcsConnection.getProviderType() == EVcsProvider.GITHUB
? "github"
: "bitbucket_cloud";
String vcsProvider = switch (vcsConnection.getProviderType()) {
case GITHUB -> "github";
case GITLAB -> "gitlab";
default -> "bitbucket_cloud";
};

Long prId = payload.pullRequestId() != null
? Long.parseLong(payload.pullRequestId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,20 @@ private SummarizeRequest buildSummarizeRequest(
}
} else if (vcsConnection.getConnectionType() == EVcsConnectionType.APP) {
accessToken = tokenEncryptionService.decrypt(vcsConnection.getAccessToken());
} else if (vcsConnection.getConnectionType() == EVcsConnectionType.PERSONAL_TOKEN ||
vcsConnection.getConnectionType() == EVcsConnectionType.REPOSITORY_TOKEN) {
// For GitLab personal/repository tokens, get the token from config
if (vcsConnection.getConfiguration() instanceof org.rostilos.codecrow.core.model.vcs.config.gitlab.GitLabConfig gitLabConfig) {
accessToken = gitLabConfig.accessToken();
}
}

// Determine VCS provider string
String vcsProvider = vcsConnection.getProviderType() == EVcsProvider.GITHUB
? "github"
: "bitbucket_cloud";
String vcsProvider = switch (vcsConnection.getProviderType()) {
case GITHUB -> "github";
case GITLAB -> "gitlab";
default -> "bitbucket_cloud";
};

return new SummarizeRequest(
project.getId(),
Expand Down