Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make CLI aware if the PR is made from a fork repo #733

Closed
Tracked by #732
dana-yaish opened this issue Nov 3, 2023 · 0 comments · Fixed by codecov/codecov-cli#328 or codecov/codecov-cli#329
Closed
Tracked by #732
Assignees

Comments

@dana-yaish
Copy link

dana-yaish commented Nov 3, 2023

CodecovCLI would detect if the PR is happening from a fork to an upstream repo. In the case of public repos, CLI can make an API request without authentication, so no tokens needed. The CLI already has the PR number via _get_pull_request_number method in each CI adapter, we can use it to make a request to https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request (upstream repo slug available via GITHUB_REPOSITORY env var). If the head.repo.full_name is different than GITHUB_REPOSITORY or base.repo.full_name then we can assume it's a pull from a fork. So this step works for public GitHub repos, another investigation is needed for private repos for the ability to get an auth token to be used within a fork PR. Similar API requests can be made for other providers. Also note that this step can help in fixing the branch conflation issue #661 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant