potiuk commented on code in PR #33365:
URL: https://github.com/apache/airflow/pull/33365#discussion_r1292831474


##########
scripts/ci/openapi/client_codegen_diff.py:
##########
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import subprocess
+
+
+def run_command(commands: list):
+    result = subprocess.run(commands, check=True, capture_output=True, 
text=True)
+    if result.returncode != 0:
+        print(f"Error running command: {result.stderr}")
+        exit(1)
+    return result.stdout
+
+
+# HEAD^1 says the "first" parent. For PR merge commits, or main commits, this 
is the "right" commit.
+#
+# In this example, 9c532b6 is the PR commit (HEAD^2), 4840892 is the head 
GitHub checks-out for us,
+# and db121f7 is the "merge target" (HEAD^1) -- i.e. mainline
+
+def client_codegen_diff():

Review Comment:
   As discussed on slack. I think this script could be simply converted in the 
`breeze ci build-api-client` command.
   
   There are multiple benefits (from ease of use starting, through autocomplete 
and auatomated documenation, ending with automatically managed virtualenv).
   
   Also I think that could be useful to use Python native stdlib where needed - 
for example `mkdir` could be easily done using pathlib



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to