diff --git a/.github/workflows/backwards_compatibility.yml b/.github/workflows/backwards_compatibility.yml index 7984b3421..6ef39c4f6 100644 --- a/.github/workflows/backwards_compatibility.yml +++ b/.github/workflows/backwards_compatibility.yml @@ -13,15 +13,28 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Print the event payload + run: cat "$GITHUB_EVENT_PATH" + - name: Check for BREAKING_CHANGE in commit message id: check_commit run: | - COMMIT_MSG=$(git log --format=%B -n 1 HEAD) - echo "Commit message: $COMMIT_MSG" - if echo "$COMMIT_MSG" | grep -q "BREAKING_CHANGE"; then + BREAKING_CHANGE_FOUND=false + for COMMIT in $(git log --format=%H HEAD^..HEAD); do + COMMIT_MSG=$(git log --format=%B -n 1 $COMMIT) + echo "Commit message: $COMMIT_MSG" + if echo "$COMMIT_MSG" | grep -q "BREAKING_CHANGE"; then + BREAKING_CHANGE_FOUND=true + break + fi + done + + if $BREAKING_CHANGE_FOUND; then echo "skip=true" >> $GITHUB_OUTPUT + echo "skip=true, 'BREAKING_CHANGE' found in commit message" else echo "skip=false" >> $GITHUB_OUTPUT + echo "skip=false, 'BREAKING_CHANGE' not found in commit message" fi - name: Check for BREAKING_CHANGE in pull request body @@ -29,13 +42,14 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - PR_MSG_TITLE=$(jq -r .pull_request.title "$GITHUB_EVENT_PATH") - PR_MSG_BODY=$(jq -r .pull_request.body "$GITHUB_EVENT_PATH") + PR_MSG_BODY=${{ github.event.pull_request.body }} echo "Pull Request body: $PR_MSG_BODY" if [[ "$PR_MSG_BODY" == *"BREAKING_CHANGE"* ]]; then echo "skip=true" >> $GITHUB_OUTPUT + echo "skip=true, 'BREAKING_CHANGE' found in pull request body" else echo "skip=false" >> $GITHUB_OUTPUT + echo "skip=false, 'BREAKING_CHANGE' not found in pull request body" fi build_and_test: @@ -44,6 +58,8 @@ jobs: if: ${{ needs.check_commit_message.outputs.should_skip != 'true' }} steps: - run: echo "${{ needs.check_commit_message.outputs.should_skip }}" + - run: echo "${{ needs.check_commit_message.outputs.should_skip }}" + - run: echo "${{ needs.check_commit_message.outputs.should_skip }}" - uses: actions/checkout@v4 with: