vsoch / pull-request-action

open a pull request when a branch is pushed or updated
https://github.com/marketplace/actions/pull-request-action
MIT License
173 stars 62 forks source link

If PR exists, update title and body #59

Closed shaungrady closed 3 years ago

shaungrady commented 3 years ago

In my workflow, the PR title and body are dynamically generated based on the commits contained within. I would love it if this action could update the title and body of the PR the PR is already found.

vsoch commented 3 years ago

hey @shaungrady ! It looks like this is definitely possible: https://docs.github.com/en/rest/reference/pulls#update-a-pull-request. I'll try to take a look soon and see if I can add this. Likely I'd keep the default to still exit if the PR is open, but we could add a variable that you could use to specify wanting an update in this case. I'll definitely try to make some time in the next week or so to work on this, stay tuned!

vsoch commented 3 years ago

hey @shaungrady - here is a branch for you to test! https://github.com/vsoch/pull-request-action/pull/60 See in the description how it works - if you set PULL_REQUEST_UPDATE it will update the existing PR instead of exiting or otherwise ending. I also did some refactoring of the main function body to take advantage of sharing the functions for adding reviewers and assignees regardless of an update or creation, so we will want to check that everything still works. Thank you for testing!

shaungrady commented 3 years ago

Sorry I haven't gotten back to you @vsoch, I ended up solving the issue by hand with actions/github-script@v3 before you opened up your PR. Not sure when I'll have time to give it a test.

vsoch commented 3 years ago

As long as you eventually do it (can you give me a sense of when?) there is definitely no rush! I did jump on doing this fix for you, so I hope that you could make some small amount of time in the future to test it - it's a fairly nice feature and I suspect others will appreciate having it, even if you found another solution.

shaungrady commented 3 years ago

Don't get me wrong, I do appreciate your speed and responsiveness on this issue. I'll try to make some time this weekend.

vsoch commented 3 years ago

Thank you! <3