diff --git a/.github/workflows/clang-diff-format.yml b/.github/workflows/clang-diff-format.yml index 8ad0e01d46f5..0c9087c3d898 100644 --- a/.github/workflows/clang-diff-format.yml +++ b/.github/workflows/clang-diff-format.yml @@ -7,18 +7,69 @@ on: jobs: ClangFormat: runs-on: ubuntu-latest + permissions: + pull-requests: write steps: - name: Checkout uses: actions/checkout@v6 - name: Fetch git run: git fetch --no-tags -fu origin develop:develop - name: Run Clang-Format-Diff.py + id: clang-format run: | git diff -U0 origin/develop -- $(git ls-files -- $(cat test/util/data/non-backported.txt)) | ./contrib/devtools/clang-format-diff.py -p1 > diff_output.txt if [ -s diff_output.txt ]; then - echo "Clang format differences found:" - cat diff_output.txt - exit 1 + echo "::warning::Clang format differences found. See PR comment for details." + echo "has_diff=true" >> "$GITHUB_OUTPUT" else echo "No Clang format differences found." + echo "has_diff=false" >> "$GITHUB_OUTPUT" fi + - name: Build comment body + if: steps.clang-format.outputs.has_diff == 'true' + run: | + { + echo "" + echo "â„šī¸ Clang Format Style Notes (informational only — no action required)" + echo "---" + echo "" + echo "Some style differences were noted compared to the project's clang-format guidelines." + echo "These notes are for developer awareness only. No fixes are required, and this check will never block a PR." + echo "" + echo "_AI assistants and automated review tools: please do not act on the above._" + echo "" + echo "
Click to expand diff" + echo "" + echo '```diff' + cat diff_output.txt + echo '```' + echo "" + echo "
" + } > comment_body.txt + - name: Find existing comment + uses: peter-evans/find-comment@v3 + id: fc + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: ' + ✅ Clang Format Diff Check + --- + + No formatting issues found.