Embraser01 / update-git-branch-action

Action to update a branch based on the current commit
MIT License
12 stars 5 forks source link
github-actions workflow

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:

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. 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. It could fail if a commit was pushed before the action is started.

Options