From 9a06690fa61ffda1968ed97f63fbbeb7e5772be0 Mon Sep 17 00:00:00 2001 From: cpu1 Date: Mon, 21 Aug 2023 16:00:57 +0530 Subject: [PATCH] Fix merge release workflow when there is nothing to merge --- .github/workflows/release-merge.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-merge.yaml b/.github/workflows/release-merge.yaml index 73ed2d54be..e22dfb48b2 100644 --- a/.github/workflows/release-merge.yaml +++ b/.github/workflows/release-merge.yaml @@ -19,17 +19,22 @@ jobs: with: token: "${{ secrets.GITHUB_TOKEN }}" - name: Merge release branch into ${{env.DEFAULT_BRANCH}} + id: merge-changes run: | git checkout $DEFAULT_BRANCH git checkout -b merge-${{ github.sha }} - git merge --no-commit --no-ff ${{ github.ref }} + if [ "$(git merge --no-commit --no-ff ${{ github.ref }})" = "Already up to date." ]; then + exit 0; + fi git checkout ORIG_HEAD -- $VERSION_FILE git add $VERSION_FILE EDITOR=true git merge --continue ! git diff --exit-code $DEFAULT_BRANCH...HEAD || exit 1 git push --set-upstream origin HEAD + echo "changes=true" >> $GITHUB_OUTPUT - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 #v6.4.1 name: Open PR to ${{env.DEFAULT_BRANCH}} + if: steps.merge-changes.outputs.changes == 'true' with: github-token: ${{ secrets.EKSCTLBOT_TOKEN }} script: |