File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,33 @@ def handle_generate(dry_run=False):
5454 logger .error (e )
5555 sys .exit (1 )
5656
57+ library_id = request_data .get ("id" )
58+ print (library_id )
59+ if not library_id :
60+ logger .error ("Request file is missing required 'id' field." )
61+ sys .exit (1 )
62+
63+ for api in request_data .get ("apis" , []):
64+ api_path = api .get ("path" )
65+ print (api_path )
66+ if api_path :
67+ try :
68+ query = f'filter("-py$", kind("rule", //{ api_path } /...:*))'
69+ command = ["bazelisk" , "query" , query ]
70+ result = subprocess .run (
71+ command , capture_output = True , text = True , check = True
72+ )
73+
74+ bazel_rule = result .stdout .strip ()
75+ if not bazel_rule :
76+ raise ValueError ("Bazel query returned an empty result." )
77+
78+ logger .info (f" - Found Bazel rule: { bazel_rule } " )
79+ except Exception as e :
80+ raise e
81+ else :
82+ pass
83+
5784 # Print the data:
5885 print (json .dumps (request_data , indent = 2 ))
5986
You can’t perform that action at this time.
0 commit comments