korthout / backport-action

Fast and flexible GitHub action to cherry-pick merged pull requests to selected branches
MIT License
61 stars 26 forks source link

Workflow dispatch support #433

Closed chancez closed 1 month ago

chancez commented 2 months ago

Is your feature request related to a problem? Please describe.

I'd like to be able to manually trigger the workflow with the PR number as an input.

I have a couple of use cases for this:

Based on the code here: https://github.com/korthout/backport-action/blob/main/src/github.ts#L57-L65 and some trial/error, it doesn't seem to work with workflow dispatch events.

Describe the solution you'd like An input variable to specify the PR number to run against, and if set, it takes precedence over the value in the payload.

Describe alternatives you've considered

It could directly check the payload for workload_dispatch rather than accepting new inputs for the PR directly, however I that's less flexible and requires the workflow to be written a particular way.

Additional context

I tried with workflow dispatch already and got this error:

Run chancez/backport-action@pr/chancez/static_labels
Retrieve pull request data for #undefined
Check whether pull request undefined is merged
Create comment: Only merged pull requests can be backported.
HttpError: Not Found
    at /home/runner/work/_actions/chancez/backport-action/pr/chancez/static_labels/node_modules/@octokit/request/dist-node/index.js:112:1
    at processTicksAndRejections (node:internal/process/task_queues:95:5)