Associate PR with manually triggered workflow_dispatch

We have a workflow that is triggered by workflow_dispatch. When we run this workflow on a ref via API or UI, there doesn’t seem to be a way to associate the run with a particular PR. It would be nice if we could, so we could see the PR information on the run in the workflow runs list, instead of the generic run name. Since push based workflows get this automagically, something tells me Github is doing something under the hood to make that kind of functionality work.

The docs don’t seem to indicate any kind of parameter we can send to this effect, so I’m curious if maybe I’m missing a step, or if this goes in the pile of “things we’d like to have.”

Question: Why not trigger on the PR creation instead?

Can you provide some more context, or maybe link to an example, so I can understand better what you are doing?

That’s a fair question. We wanted the workflow to be elective. It’s a testing workflow and doesn’t necessarily need to be run. On top of that (and probably more importantly), we can’t run the workflow until we publish the sha that was committed, which is outside of our GitHub actions flow.

So workflow_dispatch is used to manually trigger a workflow. So you are going to the Actions tab and manually running this, against a particular branch. I’m not understanding how I would know what PR to tie that run back to, since you triggered manually, and there could be multiple PRs.

Are you passing anything into the manual run as a parameter, such as the PR name?

Ahh, but I think what you are wanting, if I’m reading this correctly, is not necessarily to have the run show up as a check on the PR, but in the list of workflow runs, you want to be able to modify the displayed information. Ok, I get it. No, unfortunately there isn’t any API that allows you to modify the information on that particular page.

So, we’re usually using the API to kick off the workflow. I realize in the current situation, there’s no way to provide PR information, but it would be good if we could. I don’t feel like it should be something limited to PR specific events.

PS: we already have a means for the check to show up on the PR. We just post the status manually. This is just kind of a reverse information lookup where we see the PR information on the action list. It’s just not very useful to see a list of actions of varying statuses with all exactly the same name. If Even we could modify the metadata (title etc) at least we could manually post the PR name and such.

1 Like