How to update fork's pull request HEAD from the Github API?

Note: The PR has “allow edits from maintainers” enabled.

I am trying to use the PATCH /repos/{owner}/{repo}/git/refs/{ref} API to update a fork’s pull request HEAD through the API.

If it were not a fork, I’d be able to use the heads/{branch} ref.

I have tried to use the pull/{number}/head ref but I can’t because it’s read-only.

I have tried to target the fork’s ref (i.e. /repos/{fork_owner}/{fork_repo}/git/refs/heads/{fork_branch}) but then I get access denied.

Not sure what to try next.

Hey there @joao-paulo-parity :wave:

Just a couple questions here to help move things forward…

Is this fork from a private repository, and does it happen to be from within an Organization, or from a User account?

The relationship between the fork and it’s “parent,” will not be able to be released by API action alone and would likely require a manual action from GitHub staff.

If you could let us know the particulars of the repo and the fork you’re trying to work from, that would be excellent!

Hello. I’ve asked this almost a week ago so I have a workaround for the the problem now: I’m creating a temporary ref, pulling it, then deleting it after.

Here’s the code for the workaround.

I’m going through all of this trouble because I want the bot’s commits to be signed and verified; and the only way I found of doing that is by creating commits through the API.

1 Like