summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-01-10 04:54:25 +0800
committerGitHub <noreply@github.com>2025-01-09 20:54:25 +0000
commit85aba23cbeea2e651fa1d3f88345f9ba4d4bd4a8 (patch)
tree9dc96875f57ffdbb99ab257fc6fc2b305bfa4bb1 /.github/workflows
parent2d1ebadb9b65ef8d57f998031f022b29842b40e4 (diff)
ci(clang-format): directly do the clang-format instead of error (#8955)
Will suggest a clang-format fix on every MR that violates it.
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/ci.yaml24
1 files changed, 24 insertions, 0 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 22421d18..65bfa1ca 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -126,3 +126,27 @@ jobs:
- name: clang-format check
run: ninja -C build clang-format-check
+
+ - name: clang-format apply
+ if: ${{ failure() && github.event_name == 'pull_request' }}
+ run: ninja -C build clang-format
+
+ - name: Create patch
+ if: ${{ failure() && github.event_name == 'pull_request' }}
+ run: |
+ echo 'Please fix the formatting issues by running [`clang-format`](https://wiki.hyprland.org/Contributing-and-Debugging/PR-Guidelines/#code-style), or directly apply this patch:' > clang-format.patch
+ echo '<details>' >> clang-format.patch
+ echo '<summary>clang-format.patch</summary>' >> clang-format.patch
+ echo >> clang-format.patch
+ echo '```diff' >> clang-format.patch
+ git diff >> clang-format.patch
+ echo '```' >> clang-format.patch
+ echo >> clang-format.patch
+ echo '</details>' >> clang-format.patch
+
+ - name: Comment patch
+ if: ${{ failure() && github.event_name == 'pull_request' }}
+ uses: mshick/add-pr-comment@v2
+ with:
+ message-path: |
+ clang-format.patch