mitchspano / sfdx-scan-pull-request

Runs sfdx-scanner on a pull request and generates in-line comments with the findings.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scan fails when pull request is initiated from a Fork

mitchspano opened this issue · comments

When the scan is initiated on a fork of the repository, the scan will fail with the following error:

fatal: ambiguous argument 'origin/master...origin/fork-branch-name': unknown revision or path not in the working tree.

I think we need to to add the target repository as a different remote:

execSync(
  `git remote add -f destination ${this.pullRequest.base.repo.git_url}`
);
execSync(`git remote update`);
execSync(
    `git diff destination/${this.pullRequest?.base?.ref}...origin/${this.pullRequest?.head?.ref} > ${DIFF_OUTPUT}`
);

Unfortunately, adding a separate remote doesn't work as easily as one would hope:
image

Error: Command failed: git remote add -f destination git://github.com/mitchspano/testActions.git
fatal: unable to connect to github.com:
github.com[0: 140.82.114.4]: errno=Connection timed out