From 50a4fd037f232c0c78af2d6baa541f9b08458837 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Thu, 23 Jan 2025 21:17:08 +0800 Subject: [PATCH 1/3] move --- .github/workflows/ci.yaml | 45 ---------------------------- .github/workflows/clang-format.yml | 48 ++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 45 deletions(-) create mode 100644 .github/workflows/clang-format.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 34c45d6bea3..bb2c74dd531 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -106,48 +106,3 @@ jobs: - name: Compile run: make release - clang-format: - permissions: read-all - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork - name: "Code Style (Arch)" - runs-on: ubuntu-latest - container: - image: archlinux - steps: - - name: Checkout repository actions - uses: actions/checkout@v4 - with: - sparse-checkout: .github/actions - - - name: Setup base - uses: ./.github/actions/setup_base - - - name: Configure - run: meson setup build -Ddefault_library=static - - - 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 '
' >> clang-format.patch - echo 'clang-format.patch' >> 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 - - - name: Comment patch - if: ${{ failure() && github.event_name == 'pull_request' }} - uses: mshick/add-pr-comment@v2 - with: - message-path: | - clang-format.patch diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml new file mode 100644 index 00000000000..e935a605bfc --- /dev/null +++ b/.github/workflows/clang-format.yml @@ -0,0 +1,48 @@ +name: clang-format +on: pull_request_target +jobs: + clang-format: + permissions: write-all + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork + name: "Code Style (Arch)" + runs-on: ubuntu-latest + container: + image: archlinux + steps: + - name: Checkout repository actions + uses: actions/checkout@v4 + with: + sparse-checkout: .github/actions + + - name: Setup base + uses: ./.github/actions/setup_base + + - name: Configure + run: meson setup build -Ddefault_library=static + + - 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 '
' >> clang-format.patch + echo 'clang-format.patch' >> 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 + + - name: Comment patch + if: ${{ failure() && github.event_name == 'pull_request' }} + uses: mshick/add-pr-comment@v2 + with: + message-path: | + clang-format.patch From 679606ebe4ae03c155ef959d2bebdad0e89f7290 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Fri, 24 Jan 2025 13:06:13 +0800 Subject: [PATCH 2/3] revert, comment via peter-evans/commit-comment@v3 --- .github/workflows/ci.yaml | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bb2c74dd531..20a51d14be4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -106,3 +106,47 @@ jobs: - name: Compile run: make release + clang-format: + permissions: read-all + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork + name: "Code Style (Arch)" + runs-on: ubuntu-latest + container: + image: archlinux + steps: + - name: Checkout repository actions + uses: actions/checkout@v4 + with: + sparse-checkout: .github/actions + + - name: Setup base + uses: ./.github/actions/setup_base + + - name: Configure + 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: Create patch + 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 '```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() + uses: peter-evans/commit-comment@v3 + with: + message-path: clang-format.patch From 7d4d545ff38d0601adfefc946827b67a20f5b2b2 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sat, 25 Jan 2025 09:39:25 +0800 Subject: [PATCH 3/3] remove --- .github/workflows/ci.yaml | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 20a51d14be4..416ea93b744 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -127,26 +127,3 @@ jobs: - name: clang-format check run: ninja -C build clang-format-check - - - name: clang-format apply - if: failure() - run: ninja -C build clang-format - - - name: Create patch - 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 '```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() - uses: peter-evans/commit-comment@v3 - with: - message-path: clang-format.patch