monorepo icon indicating copy to clipboard operation
monorepo copied to clipboard

Github Actions `isFork` False Positive

Open tynes opened this issue 4 years ago • 1 comments

I am observing an error running codechecks in Github Actions - Provider should never be in fork mode and not in PR mode! It appears as if there is a false positive as the PR is not coming from a fork. The code is here:

https://github.com/codechecks/monorepo/blob/13986fee646918b63841f04bc4a2f3d0cf9c7000/packages/client/src/getExecutionContext.ts#L20-L25

For Github actions, !pr is always true

https://github.com/codechecks/monorepo/blob/ba52ad88a50898bf4ad246fd16ce5f7f7ada4034/packages/client/src/ci-providers/GithubActions.ts#L14-L16

And isFork is always true because GITHUB_HEAD_REF is set for PRs submitted from the same repo. See the docs here: https://docs.github.com/en/actions/reference/environment-variables

https://github.com/codechecks/monorepo/blob/ba52ad88a50898bf4ad246fd16ce5f7f7ada4034/packages/client/src/ci-providers/GithubActions.ts#L27-L31

GITHUB_HEAD_REF	Only set for pull request events. The name of the head branch.

Perhaps there is a better way to determine there the PR is coming from a fork, will update if I determine a good solution

tynes avatar May 05 '21 18:05 tynes

It should be fixed in: https://github.com/codechecks/monorepo/pull/81

beta released as: @codechecks/[email protected]

krzkaczor avatar May 05 '21 23:05 krzkaczor