Sync master to development automatically #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync master to development | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
sync-master-to-development: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Configure Git | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Fetch all branches | |
run: git fetch --all | |
- name: Check for changes between branches | |
id: check_diff | |
run: | | |
git checkout master | |
git pull | |
git checkout querydsl-7.0 | |
git pull | |
git diff --exit-code master querydsl-7.0 | |
continue-on-error: true | |
- name: Create Pull Request | |
if: steps.check_diff.outcome == 'failure' | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
source: master | |
target: querydsl-7.0 | |
title: 'Sync master into querydsl-7.0' | |
body: 'This PR syncs changes from master into querydsl-7.0.' | |
branch: 'sync-master-to-querydsl-7.0' | |
- name: Enable Auto-Merge for PR | |
if: steps.check_diff.outcome == 'failure' | |
run: gh pr merge --auto --merge "$PR_URL" | |
env: | |
PR_URL: ${{ steps.create-pull-request.outputs.pull-request-url }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |