Need of User defined action button on Pull Request for executing ondemand Github Action

Is there a way in github to introduce new user defined button similar to “MergePullRequest” button on Pull request Level?

Basically, we wanted to introduce a button on pull request. When developer’s click on this button, we wanted to fire a github action ondemand.

For now, we are using github labels and triggering Github action. However, now we want to trigger this github action multiple times on demand basis.

Any hacky way or suggestion would be really helpful.


We have a GitHub build-in event “workflow_dispatch” that you can use it to manually trigger the workflow.
For example:

name: CI
  . . .

When using the “workflow_dispatch” event to manually trigger a workflow run, the GITHUB_REF of this run is the branch you select, and the GITHUB_SHA is the last commit on the GITHUB_REF branch.

You can’t select the PR merge branch (refs/pull/:prNumber/merge) as the GITHUB_REF.

Only when the workflow run is triggered on the events related to PR (pull_request, pull_request_review and pull_request_review_comment), the GITHUB_REF is the PR merge branch.