Skip to content

Commit

Permalink
fix #363 - github PR from forked repo handling
Browse files Browse the repository at this point in the history
Previously, the GitHubController would set the clone URL to the repository's clone URL (equivalent to the PR base branch clone URL); this commit instead sets the clone URL to the clone URL of the pull request HEAD, so that scanned code changes are pulled from the correct repository, whether the PR was from a branch in the same repo or from a branch in a forked repository.
  • Loading branch information
milo-minderbinder committed Jul 29, 2020
1 parent b0c274a commit f431186
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public ResponseEntity<EventResponse> pullRequest(

setExclusionProperties(cxProperties, controllerRequest);
//build request object
String gitUrl = repository.getCloneUrl();
String gitUrl = pullRequest.getHead().getRepo().getCloneUrl();
String token = properties.getToken();
log.info("Using url: {}", gitUrl);
String gitAuthUrl = gitUrl.replace(Constants.HTTPS, Constants.HTTPS.concat(token).concat("@"));
Expand Down

0 comments on commit f431186

Please sign in to comment.