Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Github] Make PR formatting job only run with C/C++ changes #69556

Merged
merged 1 commit into from
Oct 19, 2023

Conversation

boomanaiden154
Copy link
Contributor

Currently the PR formatting job only runs clang-format. There isn't a lot of utility in running it if there aren't any C/C++ changes as there will be nothing to format. This isn't super noisy currently as the job doesn't fail if there aren't any C/C++ changes, but it's a bit of a waste.

In addition, this patch names the code formatting job "Check C++ Formatting" to make it clear that this job only checks C/C++ formatting rather than Python formatting/other languages.

Currently the PR formatting job only runs clang-format. There isn't a
lot of utility in running it if there aren't any C/C++ changes as there
will be nothing to format. This isn't super noisy currently as the job doesn't
fail if there aren't any C/C++ changes, but it's a bit of a waste.

In addition, this patch names the code formatting job "Check C++
Formatting" to make it clear that this job only checks C/C++ formatting
rather than Python formatting/other languages.
@boomanaiden154
Copy link
Contributor Author

I'm guessing the plan is to extend this to check formatting with black at some point too?

@llvmbot
Copy link
Member

llvmbot commented Oct 19, 2023

@llvm/pr-subscribers-github-workflow

Author: Aiden Grossman (boomanaiden154)

Changes

Currently the PR formatting job only runs clang-format. There isn't a lot of utility in running it if there aren't any C/C++ changes as there will be nothing to format. This isn't super noisy currently as the job doesn't fail if there aren't any C/C++ changes, but it's a bit of a waste.

In addition, this patch names the code formatting job "Check C++ Formatting" to make it clear that this job only checks C/C++ formatting rather than Python formatting/other languages.


Full diff: https://github.com/llvm/llvm-project/pull/69556.diff

1 Files Affected:

  • (modified) .github/workflows/pr-code-format.yml (+11-2)
diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml
index 3a91ffb0b1ad9a7..060646df6ae4759 100644
--- a/.github/workflows/pr-code-format.yml
+++ b/.github/workflows/pr-code-format.yml
@@ -1,10 +1,19 @@
 name: "Check code formatting"
-on: pull_request_target
+
+on:
+  pull_request_target:
+    paths:
+      - '**/*.cpp'
+      - '**/*.c'
+      - '**/*.h'
+      - '**/*.inc'
+
 permissions:
   pull-requests: write
 
 jobs:
-  code_formatter:
+  cpp_code_formatter:
+    name: "Check C++ Formatting"
     runs-on: ubuntu-latest
     steps:
       - name: Fetch LLVM sources

Copy link
Collaborator

@tstellar tstellar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This job needs to be re-written to not use pull_request_target, but that's unrelated to this change. LGTM.

@boomanaiden154 boomanaiden154 merged commit 80b2aac into llvm:main Oct 19, 2023
3 checks passed
@tru
Copy link
Collaborator

tru commented Oct 19, 2023

Please revert or extend since this now doesn't run on python files. The code formatter runs both formatting which is why I opted to not have a filter here since that means we need to maintain several lists of extensions.

boomanaiden154 added a commit that referenced this pull request Oct 19, 2023
…69556)"

This reverts commit 80b2aac.

I mistakenly assumed this job didn't also do python formatting
(should've grepped for more than just black in the python portion of
this script). Pulling it out for now to get python formatting working
again while the patch is iterated further.
@boomanaiden154
Copy link
Contributor Author

Sorry. Reverted in cd205ef. I'll post another version of this patch with the relevant python extensions when I have a chance.

Guzhu-AMD pushed a commit to GPUOpen-Drivers/llvm-project that referenced this pull request Oct 20, 2023
Local branch amd-gfx 634c100 Merged main:817519058a98 into amd-gfx:7e00bdde62c2
Remote branch main 80b2aac [Github] Make PR formatting job only run with C/C++ changes (llvm#69556)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants