How do you create a workflow dispatch event for a fork?

The workflow dispatch event API has a required ref argument. How do I get the ref for a PR from a fork? I’ve tried using refs/pull/4/head but that throws an error.

Have you tried excluding the refs prefix? You’re able to interact with Pull Requests using the pull/:id/head pattern elsewhere, so I’d expect it to work via the API.

Here’s a relevant comment I’ve written with citations for the format.

Unfortunately that doesn’t seem to work. I get the following error:

HttpError: No ref found for: pull/4/head

For what it’s worth, my code does work if I do something like this: refs/heads/test but that only works if the PR is from a branch that’s part of the repo itself.

Btw, thank you for sharing that other thread! I didn’t know you could set the ref for a pull_request_target Action. That solves a different problem we were having :slight_smile: