Description
I know it's similar issues were already posted, I've read them, didn't find a solution, so bare with me for a sec 😄
TL;DR
The problem goes down to this error:
Error: Validation Failed: {"resource":"PullRequest","field":"head","code":"invalid"}
being thrown when creating a PR from a fork which belongs to an organisation, the same organisation to which the base repo belongs to.
SETUP
We have to repos under an organisation, both public, let's call them:
base
- a repo to which we would like introduce changes, we have read only access, hence changes have to be merged by a PR from a forkCI
- hosting a workflow, triggered onpull_request
WORKFLOW
The workflow is simple, when a PR is created in the CI repo:
- checkout the base repo
- introduce some changes
- run
create-pull-request
action to create a PR using a fork.
When the fork is a personal fork (not under organisation) everything works. The problem pops up when the fork is inside the same organisation as the base repo.
PAT used for this is the classic type with public_repo
access. I did try with all possible accesses but it does not seem to be an access problem. The account for which PAT was generated is a regular organisation member with owner access to CI repo and an owner of both forks.
Below you can find links to test repos I used to reproduce the problem:
I did already spent a lot of time on this, so any help (even pointing out what I'm doing wrong) would be highly appreciated.