diff --git a/.github/workflows/mergify-ready.yml b/.github/workflows/mergify-ready.yml index 86439df95f47..5254a0816ee6 100644 --- a/.github/workflows/mergify-ready.yml +++ b/.github/workflows/mergify-ready.yml @@ -107,9 +107,17 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - + - name: Check if PR is up to date with master + id: is_based_on_main + run: | + result=$(git merge-base --is-ancestor $BASE_SHA $HEAD_SHA && echo true || echo false) + if [[ "$result" == "false" ]]; then + echo "PR is not up to date with master branch, skipping fixup commit check" + fi + echo "BRANCH_UP_TO_DATE=$result" >> $GITHUB_ENV - name: Check for fixup commits id: fixup-commits + if: ${{ env.BRANCH_UP_TO_DATE == 'true' }} run: | if [[ $(git rev-list "$BASE_SHA".."$HEAD_SHA" --grep="^\(fixup\|amend\|squash\)! " | wc -l) -eq 0 ]]; then echo "No fixup/amend/squash commits found in commit history"