repo1: https://github.com/ORG_SPACE/MAIN_REPO
repo2(forked from repo1 in same workspace): https://github.com/ORG_SPACE/FORKED_REPO
feature branch created in forked repo: https://github.com/ORG_SPACE/FORKED_REPO/tree/FEATURE_BRANCH
Authorization details: used new finegrained PAT having pull:read&write,contents:read,Metadata:read access of both repos MAIN_REPO,FORKED_REPO
ISSUE: getting 422 error response
{
"message": "Validation Failed",
"errors": [
{
"resource": "PullRequest",
"field": "head",
"code": "invalid"
}
],
"documentation_url": "https://docs.github.com/rest/reference/pulls#create-a-pull-request"
}
while hitting below curl to raise pull request to merge 'ORG_SPACE/FORKED_REPO/tree/FEATURE_BRANCH' into 'ORG_SPACE/MAIN_REPO/tree/master'
curl --location --request POST 'https://api.github.com/repos/ORG_SPACE/MAIN_REPO/pulls' \
--header 'Authorization: Bearer MY_PAT' \
--header 'Accept: application/vnd.github+json' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "test",
"head": "ORG_SPACE:FEATURE_BRANCH",
"base": "master"
}'
- tried this head value : "ORG_SPACE:FORKED_REPO/FEATURE_BRANCH" but didn't work.
- raising pull request with same api working fine for both repos while head and base are in same repo.