From f54e158d15149e46312465f242b0c5429f09ef67 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sat, 4 Jan 2025 23:22:54 +0800 Subject: [PATCH 01/10] ci --- .github/workflows/ci.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 22421d184d7..fab16e7a097 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -125,4 +125,14 @@ jobs: run: meson setup build -Ddefault_library=static - name: clang-format check - run: ninja -C build clang-format-check + run: ninja -C build clang-format + + - name: Push changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "style: clang-format" + commit_user_name: "github-actions[bot]" + commit_user_email: "github-actions[bot]@users.noreply.github.com" + commit_author: "github-actions[bot] " + # commit_branch: ${{ github.head_ref }} + From 670397455832034cc078f6047ee3ad612ed31383 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Tue, 7 Jan 2025 17:17:56 +0800 Subject: [PATCH 02/10] k --- .github/workflows/ci.yaml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fab16e7a097..5314e67554f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -125,14 +125,24 @@ jobs: run: meson setup build -Ddefault_library=static - name: clang-format check + run: ninja -C build clang-format-check + + - name: clang-format apply + if: failure() run: ninja -C build clang-format - - name: Push changes - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_message: "style: clang-format" - commit_user_name: "github-actions[bot]" - commit_user_email: "github-actions[bot]@users.noreply.github.com" - commit_author: "github-actions[bot] " - # commit_branch: ${{ github.head_ref }} + - name: Create patch + if: failure() + run: git diff > clang-format.patch + - name: Comment patch + if: failure() + uses: mshick/add-pr-comment@v2 + with: + message-path: | + clang-format.patch + find: | + please fix the following formatting issues, or directly apply the patch + ```diff + << FILE_CONTENTS >> + ``` From 6c3f0895067bc1a90068e0e64d9b801c99965d4e Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Tue, 7 Jan 2025 17:33:41 +0800 Subject: [PATCH 03/10] fix --- .github/workflows/ci.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5314e67554f..9ad7520d72f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -139,10 +139,12 @@ jobs: if: failure() uses: mshick/add-pr-comment@v2 with: - message-path: | - clang-format.patch - find: | + message: please fix the following formatting issues, or directly apply the patch ```diff << FILE_CONTENTS >> ``` + message-path: | + clang-format.patch + find: | + << FILE_CONTENTS >> From 7cd862514c2667d9ab7b74a447b622565447f101 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Tue, 7 Jan 2025 18:08:34 +0800 Subject: [PATCH 04/10] fix the fix --- .github/workflows/ci.yaml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9ad7520d72f..564ddb0f800 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -133,18 +133,20 @@ jobs: - name: Create patch if: failure() - run: git diff > clang-format.patch - - - name: Comment patch - if: failure() - uses: mshick/add-pr-comment@v2 - with: + run: | message: please fix the following formatting issues, or directly apply the patch ```diff << FILE_CONTENTS >> ``` + echo "fix the following formatting issues, or directly apply the patch" > clang-format.patch + echo '```diff' >> clang-format.patch + git diff >> clang-format.patch + echo '```' >> clang-format.patch + + - name: Comment patch + if: failure() + uses: mshick/add-pr-comment@v2 + with: message-path: | clang-format.patch - find: | - << FILE_CONTENTS >> From 39a5d641933ef086dc7347a36dde2306ba797bcd Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Tue, 7 Jan 2025 18:17:49 +0800 Subject: [PATCH 05/10] f --- .github/workflows/ci.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 564ddb0f800..57256bc0af9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -134,11 +134,6 @@ jobs: - name: Create patch if: failure() run: | - message: - please fix the following formatting issues, or directly apply the patch - ```diff - << FILE_CONTENTS >> - ``` echo "fix the following formatting issues, or directly apply the patch" > clang-format.patch echo '```diff' >> clang-format.patch git diff >> clang-format.patch From f87c27a8af2b0b58b9030c9f52879eaa2f809615 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Wed, 8 Jan 2025 18:43:26 +0800 Subject: [PATCH 06/10] k --- .github/workflows/ci.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 57256bc0af9..b2f18307445 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -134,10 +134,13 @@ jobs: - name: Create patch if: failure() run: | - echo "fix the following formatting issues, or directly apply the patch" > clang-format.patch + 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 '```
' >> clang-format.patch + echo '```clang-format.patch' >> clang-format.patch echo '```diff' >> clang-format.patch git diff >> clang-format.patch echo '```' >> clang-format.patch + echo '```
' >> clang-format.patch - name: Comment patch if: failure() From f84e5cdbecec30504b4d1e183ff51cb8c322d59d Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Wed, 8 Jan 2025 18:51:51 +0800 Subject: [PATCH 07/10] mb --- .github/workflows/ci.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b2f18307445..36a3009ab83 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -135,12 +135,12 @@ jobs: if: failure() 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 '```
' >> clang-format.patch - echo '```clang-format.patch' >> clang-format.patch + echo '
' >> clang-format.patch + echo 'clang-format.patch' >> clang-format.patch echo '```diff' >> clang-format.patch git diff >> clang-format.patch echo '```' >> clang-format.patch - echo '```
' >> clang-format.patch + echo '
' >> clang-format.patch - name: Comment patch if: failure() From 06ed273c8ea3f7bf17d5e2971dd3bf71fc9a0069 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Wed, 8 Jan 2025 19:00:35 +0800 Subject: [PATCH 08/10] wtf --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 36a3009ab83..4d9fa1e1c9f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -138,7 +138,9 @@ jobs: echo '
' >> clang-format.patch echo 'clang-format.patch' >> clang-format.patch echo '```diff' >> clang-format.patch + echo >> clang-format.patch git diff >> clang-format.patch + echo >> clang-format.patch echo '```' >> clang-format.patch echo '
' >> clang-format.patch From daa738ae9dc2a624bd7a31228885b9673a074d34 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Wed, 8 Jan 2025 19:09:39 +0800 Subject: [PATCH 09/10] ah --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4d9fa1e1c9f..bf0194ec5ff 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -137,11 +137,11 @@ jobs: 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 '
' >> clang-format.patch echo 'clang-format.patch' >> clang-format.patch - echo '```diff' >> 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 >> clang-format.patch echo '
' >> clang-format.patch - name: Comment patch From c35010bf6e1199a378e46c4fb483402a55408c34 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Thu, 9 Jan 2025 10:41:11 +0800 Subject: [PATCH 10/10] only in pr --- .github/workflows/ci.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bf0194ec5ff..65bfa1ca81d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -128,11 +128,11 @@ jobs: run: ninja -C build clang-format-check - name: clang-format apply - if: failure() + if: ${{ failure() && github.event_name == 'pull_request' }} run: ninja -C build clang-format - name: Create patch - if: failure() + 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 '
' >> clang-format.patch @@ -145,7 +145,7 @@ jobs: echo '
' >> clang-format.patch - name: Comment patch - if: failure() + if: ${{ failure() && github.event_name == 'pull_request' }} uses: mshick/add-pr-comment@v2 with: message-path: |