forked from hyprwm/Hyprland
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae403e6
commit bde80fc
Showing
2 changed files
with
48 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 '<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 |