create-pull-request: PRs fail to create due to Error: For same-org, cross-repo pulls, 'head_repo' is required: {"resource":"PullRequest","field":"head","code":"invalid"}
Subject of the issue
I have a workflow that is pushing the branch but failing to create the pull request due to a new error, when the action has worked before:
- name: Generate token using the Github App
uses: tibdex/github-app-token@v1
if: ${{ env.UPDATER_APP_ID && env.UPDATER_PRIVATE_KEY }}
id: app-token
with:
app_id: ${{ env.UPDATER_APP_ID }}
private_key: ${{ env.UPDATER_PRIVATE_KEY }}
- name: Create pull request containing any changed files
id: create-pull-request
uses: peter-evans/create-pull-request@v3
with:
branch: scheduled-updater-changes
base: ${{ github.base_ref || github.ref_name }}
delete-branch: true
token: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
title: Automatic dependency updates
body: Rest of the body truncated, not important.
Steps to reproduce
Logs where the workflow fails:
Run peter-evans/create-pull-request@v3
with:
branch: scheduled-updater-changes
base: main
delete-branch: true
token: ***
title: Automatic dependency updates
body: Rest of the body truncated, not important.
add-paths: -A
commit-message: [create-pull-request] automated change
committer: GitHub <noreply@github.com>
author: Reid-Dave_pfghub <Reid-Dave_pfghub@users.noreply.github.com>
signoff: false
draft: false
...
Pushing pull request branch to 'origin/scheduled-updater-changes'
/usr/bin/git push --force-with-lease origin HEAD:refs/heads/scheduled-updater-changes
remote:
remote: Create a pull request for 'scheduled-updater-changes' on GitHub by visiting:
remote: https://github.com/***/private-repo/pull/new/scheduled-updater-changes
remote:
To https://github.com/***/private-repo
* [new branch] HEAD -> scheduled-updater-changes
Create or update the pull request
Attempting creation of pull request
Error: For same-org, cross-repo pulls, 'head_repo' is required: {"resource":"PullRequest","field":"head","code":"invalid"}
I cannot link to the actual logs since it is a private repository.
The same exact workflow from Dec 22 succeeded:
Run peter-evans/create-pull-request@v3
with:
branch: scheduled-updater-changes
base: main
delete-branch: true
token: ***
title: Automatic dependency updates
body: Rest of the body truncated, not important.
add-paths: -A
commit-message: [create-pull-request] automated change
committer: GitHub <noreply@github.com>
author: Reid-Dave_pfghub <Reid-Dave_pfghub@users.noreply.github.com>
signoff: false
draft: false
...
Pushing pull request branch to 'origin/scheduled-updater-changes'
/usr/bin/git push --force-with-lease origin HEAD:refs/heads/scheduled-updater-changes
remote:
remote: Create a pull request for 'scheduled-updater-changes' on GitHub by visiting:
remote: https://github.com/***/private-repo/pull/new/scheduled-updater-changes
remote:
To https://github.com/***/private-repo
* [new branch] HEAD -> scheduled-updater-changes
Create or update the pull request
Attempting creation of pull request
Created pull request #12 (***:scheduled-updater-changes => main)
I’m also not able to replicate this consistently. The same exact workflow works fine in another private repository, it seems to be this specific repository causing the issue.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 2
- Comments: 52 (13 by maintainers)
I have tried in one of the failing repositories. It is working again.
I found this other issue by searching GitHub. It looks related. https://github.com/coilhq/web-monetization-projects/issues/3558
I’m keeping an eye out for similar issues: https://github.com/search?q=“For+same-org%2C+cross-repo+pulls”&type=issues
I haven’t had a response from GitHub Support yet.
GitHub engineering are now investigating.
Can confirm it’s happening with v4 (I’m working with @chachasikes )
Thank you everyone who reported this, and @peter-evans for investigating and @gm3dmo for the fix!
It was solved, thanks!
@gm3dmo Thank you for the fix!
its working thank you
The mysterious thing is that several other similar private repositories under the same organization account didn’t fail and were just fine, using the exact same workflow (and same Github token generation via Github App). It seems isolated to one repository, I just can’t figure out why. All the logs look the same and I cannot find any distinguishing factor in the workflow runs.
I’m unable to reproduce this issue. Please could you explain a bit more about your scenario.
Thanks for the report. I’m looking into this.
There haven’t been any changes to the action that I think could have caused this, so it’s likely to be a change with GitHub’s API.
@chachasikes The deprecation warning is unrelated. See https://github.com/peter-evans/create-pull-request/issues/1336