[llvm] 56d0e8c - [Github] Print diff in code format helper (#72742)

via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 18 01:06:45 PST 2023


Author: Aiden Grossman
Date: 2023-11-18T01:06:40-08:00
New Revision: 56d0e8ccf424ddcd74a505837b8966204aaba415

URL: https://github.com/llvm/llvm-project/commit/56d0e8ccf424ddcd74a505837b8966204aaba415
DIFF: https://github.com/llvm/llvm-project/commit/56d0e8ccf424ddcd74a505837b8966204aaba415.diff

LOG: [Github] Print diff in code format helper (#72742)

Currently, when the code format action fails, it leaves no log of the
diff in the output within the action itself. This has caused confusion
for some users of the action, especially when the comment becomes buried
in a 100+ comment review and someone isn't super familiar with the inner
workings of the CI. This patch prints the diff produced by the code
formatter to stdout so that it is viewable by clicking on the failed
action. This should have very little cost and make things slightly less
confusing for those that run into this situation.

Added: 
    

Modified: 
    llvm/utils/git/code-format-helper.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py
index c45bb4d935d478a..32745768dc74c4d 100644
--- a/llvm/utils/git/code-format-helper.py
+++ b/llvm/utils/git/code-format-helper.py
@@ -156,6 +156,8 @@ def format_run(
         if proc.returncode != 0:
             # formatting needed, or the command otherwise failed
             print(f"error: {self.name} exited with code {proc.returncode}")
+            # Print the 
diff  in the log so that it is viewable there
+            print(proc.stdout.decode("utf-8"))
             return proc.stdout.decode("utf-8")
         else:
             sys.stdout.write(proc.stdout.decode("utf-8"))
@@ -200,6 +202,8 @@ def format_run(
         if proc.returncode != 0:
             # formatting needed, or the command otherwise failed
             print(f"error: {self.name} exited with code {proc.returncode}")
+            # Print the 
diff  in the log so that it is viewable there
+            print(proc.stdout.decode("utf-8"))
             return proc.stdout.decode("utf-8")
         else:
             sys.stdout.write(proc.stdout.decode("utf-8"))


        


More information about the llvm-commits mailing list