From dcc1ff37bc99b10e8f676211276b4a7409471c6b Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 13 Dec 2024 12:33:11 +0300 Subject: [PATCH] ci: do not check `--ff-only` on master branch --- .github/workflows/merge-check.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/merge-check.yml b/.github/workflows/merge-check.yml index 73757d7dc6440..f70500e8ca220 100644 --- a/.github/workflows/merge-check.yml +++ b/.github/workflows/merge-check.yml @@ -25,16 +25,20 @@ jobs: - name: Check merge --ff-only run: | - git fetch origin master:master - if [[ "${{ github.event_name }}" == "pull_request"* ]]; then - git fetch origin ${{ github.event.pull_request.base.ref }}:base_branch - git checkout base_branch - git pull --rebase=false origin pull/${{ github.event.pull_request.number }}/head - git checkout master - git merge --ff-only base_branch + if [[ "${{ github.ref_name }}" == "master" ]]; then + echo "Already on master, no need to check --ff-only" else - git checkout master - git merge --ff-only ${{ github.sha }} + git fetch origin master:master + if [[ "${{ github.event_name }}" == "pull_request"* ]]; then + git fetch origin ${{ github.event.pull_request.base.ref }}:base_branch + git checkout base_branch + git pull --rebase=false origin pull/${{ github.event.pull_request.number }}/head + git checkout master + git merge --ff-only base_branch + else + git checkout master + git merge --ff-only ${{ github.sha }} + fi fi - name: add labels