Skip to content
git-merge

GitHub Action

Merge and Stop

v2.0.5 Latest version

Merge and Stop

git-merge

Merge and Stop

Merge into branch without committing and pushing

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Merge and Stop

uses: zgosalvez/github-actions-merge-and-stop@v2.0.5

Learn more about this action in zgosalvez/github-actions-merge-and-stop

Choose a version

GitHub Action — Merge and Stop

This GitHub Action (written in JavaScript) allows you to leverage GitHub Actions to merge the current branch into another branch without committing and pushing. This is very useful when you want to run assertions assuming the pull-request was merged using the defined method.

Usage

Pre-requisites

Create a workflow .yml file in your .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.

Inputs

All of these inputs are required. For more information on these inputs, see the Workflow syntax for GitHub Actions

  • method: The merging method to use. Currently supports '' and squash. Optional. Default: ''
  • reference: The branch/commit reference to merge into the current branch. For example, origin/${{ github.head_ref }}

Outputs

None.

Common workflow

Ideally, set this up as an initial job for your workflows. For example:

on: pull_request

name: Continuous Integration

jobs:
  build:
    name: Example
    runs-on: ubuntu-latest
    steps:
      - name: Clone the repository
        uses: actions/checkout@v2
        with:
          ref: ${{ github.base_ref }}
          fetch-depth: 0
      - name: Merge and stop
        uses: zgosalvez/github-actions-merge-and-stop@v2
        with:
          method: squash
          reference: origin/${{ github.base_ref }}

License

The scripts and documentation in this project are released under the MIT License