https://github.com/embraser01/update-git-branch-action
Action to update a branch based on the current commit
https://github.com/embraser01/update-git-branch-action
github-actions workflow
Last synced: 12 months ago
JSON representation
Action to update a branch based on the current commit
- Host: GitHub
- URL: https://github.com/embraser01/update-git-branch-action
- Owner: Embraser01
- License: mit
- Created: 2019-04-20T15:55:57.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-15T16:50:40.000Z (over 6 years ago)
- Last Synced: 2025-06-30T14:09:30.781Z (12 months ago)
- Topics: github-actions, workflow
- Language: JavaScript
- Size: 33.5 MB
- Stars: 12
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Update git branch action
A GitHub Action that update a specific branch to the current commit running the action.
## Usage
This GitHub Action update a branch. Here's an example workflow that update a staging branch at
each commit on master you push a commit on master:
```yaml
on: push
name: Update prod branch on release
jobs:
updateBranch:
name: Update staging branch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: Embraser01/update-git-branch-action@v1.0.0
if: github.ref == 'refs/heads/master'
with:
branch: staging
force: 1 # To push-force to the branch
githubToken: ${{ secrets.PAT_TOKEN }} # Github Token
```
## Github token
If you want to trigger another workflow, you'll need to generate a Personal Access Token
[here](https://github.com/settings/tokens). Pushing a commit with the `GITHUB_TOKEN` env
variable will not trigger other workflows.
## Tags
When a tag is pushed, the action will check if the tag is the HEAD of a protected branch. It
uses the
[Github API](https://developer.github.com/v3/repos/commits/#list-branches-for-head-commit). It
could fail if a commit was pushed before the action is started.
## Options
- `branch`: The branch to update (**required**).
- `force`: Indicates whether to force the update or to make sure the update is a fast-forward
update. Leaving this out or setting it to `false` will make sure you're not overwriting work.
- `githubToken`: Github token required to push the commit to the branch.