Is there a way to push changes with a GitHub action?

Ben Cooper picture Ben Cooper · Apr 12, 2019 · Viewed 7.8k times · Source

This question refers to this: https://github.com/features/actions

I have written a GitHub action to build my code and create a production bundle. I'd like to have that included into my repository by committing the changes to origin/master. This seems like an obvious feature for GitHub actions to have but I can't find it anywhere. How do I commit changes with a GitHub action and push them?

Answer

peterevans picture peterevans · Oct 5, 2019

Update: Please see the following question/answer for full details about how to push changes back to the remote. Push to origin from GitHub action

An alternative option is create-pull-request action. It will automatically commit changes to a new branch and raise a pull request for you to review the changes. I wrote a detailed explanation about it as an answer to another question here: https://stackoverflow.com/a/58004257/11934042