Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 216
Ben Cooper Avatar asked Apr 12 '19 18:04

Ben Cooper


People also ask

Can GitHub Actions commit changes?

You can use this GitHub Action to commit changes made in your workflow run directly to your repo: for example, you use it to lint your code, update documentation, commit updated builds, etc...

How do I push actions in GitHub?

Steps to trigger repository dispatches To do this, first create a personal access token. Verify that an action run is happening. Open up the Publish modal in a Plasmic project, and input the webhook above. Remove the Push To GitHub action in the Plasmic publish dialog.

Can you deploy with GitHub Actions?

GitHub Actions offers features that let you control deployments. You can: Trigger workflows with a variety of events. Configure environments to set rules before a job can proceed and to limit access to secrets.

What is possible with GitHub Actions?

GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate your build, test, and deployment pipeline. You can create workflows that build and test every pull request to your repository, or deploy merged pull requests to production.

What is the use of GitHub actions?

GitHub Action for GitHub Push. The GitHub Actions for pushing to GitHub repository local changes authorizing using GitHub token. With ease: update new code placed in the repository, e.g. by running a linter on it, track changes in script results using Git as archive, publish page using GitHub-Pages, mirror changes to a separate repository. Usage

How to push changes to origin from GitHub action?

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.

How to push changes to a specific Repository in GitHub?

The GitHub Actions for pushing to GitHub repository local changes authorizing using GitHub token. mirror changes to a separate repository. Personal Access Token. Destination branch to push changes. Can be passed in using $ { { github.ref }}.

Should I update my local branch before pushing changes to GitHub?

Before pushing changes, you should update your local branch to include any commits that have been added to the remote repository. If someone has made commits on the remote that are not on your local branch, GitHub Desktop will prompt you to fetch the new commits before pushing your changes to avoid merge conflicts.


Video Answer


2 Answers

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

like image 79
peterevans Avatar answered Sep 19 '22 11:09

peterevans


I found the stefanzweifel/git-auto-commit-action to be the best solution. It's really as easy as:

- uses: stefanzweifel/git-auto-commit-action@v4

One could, of course, tune the parameters, like commit message, file globs and many others.

like image 44
madhead - StandWithUkraine Avatar answered Sep 17 '22 11:09

madhead - StandWithUkraine