A GitHub action which directly merges one branch into another (without a PR) in given repository.
Action expects up to 6 parameters:
GITHUB_TOKEN
- standard token taken from:secrets.GITHUB_TOKEN
- requiredsource-branch
- branch to merge from - requiredtarget-branch
- branch to merge to - requiredowner
- owner of the repository - optional, uses owner of current repository as defaultrepo
- name of the repository - optional, uses current repository as defaultcommit-message
- message to use for the commit - optional, uses "Automatic merge of <source-branch> -> <target-branch>" as default
# .github/workflows/main.yml
name: Main workflow
on:
push:
branches: [master]
jobs:
merge-master-to-develop:
name: Merge master -> develop
runs-on: ubuntu-latest
steps:
uses: tukasz/direct-merge-action@master
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
owner: tukasz
repo: direct-merge-action
source-branch: master
target-branch: develop
commit-message: "Lorem ipsum..."
# .github/workflows/main.yml
name: Main workflow
on:
push:
branches: [master]
jobs:
merge-master-to-develop:
name: Merge master -> develop
runs-on: ubuntu-latest
steps:
uses: tukasz/direct-merge-action@master
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
source-branch: master
target-branch: develop