@@ -17,7 +17,6 @@ class MattermostWebhookBody:
1717 issueThumbnail = "https://github.com/openziti/branding/blob/main/images/ziggy/closeups/Ziggy-has-an-Idea-Closeup.png?raw=true"
1818 # releaseThumbnail = "https://github.com/openziti/branding/blob/main/images/ziggy/png/Ziggy-Cash-Money-Closeup.png?raw=true"
1919 releaseThumbnail = "https://github.com/openziti/branding/blob/main/images/ziggy/closeups/Ziggy-Parties-Closeup.png?raw=true"
20- fipsReleaseThumbnail = "https://github.com/openziti/branding/blob/main/images/ziggy/closeups/Ziggy-The-Cop-Closeup.png?raw=true"
2120 watchThumbnail = "https://github.com/openziti/branding/blob/main/images/ziggy/closeups/Ziggy-is-Star-Struck.png?raw=true"
2221
2322 prColor = "#32CD32"
@@ -73,14 +72,6 @@ def __init__(self, username, icon, eventName, eventJson, actionRepo):
7372 self .addForkDetails ()
7473 elif eventName == "release" :
7574 self .addReleaseDetails ()
76- elif eventName == "repository_dispatch" :
77- event_type = self .eventJson .get ("action" , None )
78- if event_type == "ziti_release" :
79- self .addFipsPreReleaseDetails ()
80- elif event_type == "ziti_promote_stable" :
81- self .addFipsPromoteStableDetails ()
82- else :
83- self .addRepositoryDispatchGenericDetails () # fallback
8475 elif eventName == "watch" :
8576 self .addWatchDetails ()
8677 else :
@@ -285,42 +276,6 @@ def addReleaseDetails(self):
285276
286277 self .attachment ["text" ] = bodyText
287278
288- def addFipsPreReleaseDetails (self ):
289- # Pre-release announcement (ziti_release)
290- payload = self .eventJson .get ("client_payload" , {})
291- version = payload .get ("version" )
292- if not version :
293- self .attachment ["text" ] = "[ziti-fips] Pre-release published, but version not found in event."
294- return
295- repo = self .repoJson ["full_name" ]
296- release_url = f"https://github.com/{ repo } /releases/tag/v{ version } "
297- self .body ["text" ] = f"FIPS Pre-release published in [{ repo } ](https://github.com/{ repo } )"
298- self .attachment ["color" ] = self .releaseColor
299- self .attachment ["thumb_url" ] = self .fipsReleaseThumbnail
300- self .attachment ["text" ] = f"FIPS Pre-release [{ version } ]({ release_url } ) is now available."
301-
302- def addFipsPromoteStableDetails (self ):
303- # Promotion to stable announcement (ziti_promote_stable)
304- payload = self .eventJson .get ("client_payload" , {})
305- version = payload .get ("version" )
306- if not version :
307- self .attachment ["text" ] = "[ziti-fips] Stable promotion, but version not found in event."
308- return
309- repo = self .repoJson ["full_name" ]
310- release_url = f"https://github.com/{ repo } /releases/tag/v{ version } "
311- self .body ["text" ] = f"FIPS Release promoted to stable in [{ repo } ](https://github.com/{ repo } )"
312- self .attachment ["color" ] = self .releaseColor
313- self .attachment ["thumb_url" ] = self .fipsReleaseThumbnail
314- self .attachment ["text" ] = f"FIPS Release [{ version } ]({ release_url } ) has been promoted to stable."
315-
316- def addRepositoryDispatchGenericDetails (self ):
317- event_type = self .eventJson .get ("action" , None )
318- payload = self .eventJson .get ("client_payload" , {})
319- repo = self .repoJson ["full_name" ]
320- self .body ["text" ] = f"Repository dispatch event received by [{ repo } ](https://github.com/{ repo } )"
321- self .attachment ["color" ] = self .releaseColor
322- self .attachment ["text" ] = f"Repository dispatch event type: `{ event_type } `\n Payload: ```json\n { json .dumps (payload , indent = 2 )} \n ```"
323-
324279 def addWatchDetails (self ):
325280 self .body ["text" ] = f"{ self .createTitle ()} #stargazer"
326281 login = self .sender ["login" ]
@@ -446,36 +401,6 @@ def _safe_hint(s):
446401 return f"len={ hint_len } , startswith='{ head } ...'"
447402
448403
449- def generate_json_schema (obj , max_depth = 10 , current_depth = 0 ):
450- """Generate a schema representation of a JSON object by inferring types from values."""
451- if current_depth >= max_depth :
452- return "<max_depth_reached>"
453-
454- if obj is None :
455- return "null"
456- elif isinstance (obj , bool ):
457- return "boolean"
458- elif isinstance (obj , int ):
459- return "integer"
460- elif isinstance (obj , float ):
461- return "number"
462- elif isinstance (obj , str ):
463- return "string"
464- elif isinstance (obj , list ):
465- if len (obj ) == 0 :
466- return "array[]"
467- # Get schema of first element as representative
468- element_schema = generate_json_schema (obj [0 ], max_depth , current_depth + 1 )
469- return f"array[{ element_schema } ]"
470- elif isinstance (obj , dict ):
471- schema = {}
472- for key , value in obj .items ():
473- schema [key ] = generate_json_schema (value , max_depth , current_depth + 1 )
474- return schema
475- else :
476- return "unknown"
477-
478-
479404def generate_test_event (event_type ):
480405 """Generate a test GitHub event JSON for the specified event type."""
481406 base_repo = {
@@ -710,43 +635,6 @@ def doPost(url, payload):
710635 print ("ERROR: no Ziti identity provided, set INPUT_ZITIID (inline JSON or base64-encoded), or INPUT_ZITIJWT" )
711636 exit (1 )
712637
713- def generate_json_schema (obj , max_depth = 10 , current_depth = 0 ):
714- """Generate a schema representation of a JSON object by inferring types from values."""
715- if current_depth >= max_depth :
716- return "<max_depth_reached>"
717-
718- if obj is None :
719- return "null"
720- elif isinstance (obj , bool ):
721- return "boolean"
722- elif isinstance (obj , int ):
723- return "integer"
724- elif isinstance (obj , float ):
725- return "number"
726- elif isinstance (obj , str ):
727- return "string"
728- elif isinstance (obj , list ):
729- if len (obj ) == 0 :
730- return "array[]"
731- # Get schema of first element as representative
732- element_schema = generate_json_schema (obj [0 ], max_depth , current_depth + 1 )
733- return f"array[{ element_schema } ]"
734- elif isinstance (obj , dict ):
735- schema = {}
736- for key , value in obj .items ():
737- schema [key ] = generate_json_schema (value , max_depth , current_depth + 1 )
738- return schema
739- else :
740- return f"unknown_type({ type (obj ).__name__ } )"
741-
742- # Validate zitiId as JSON
743- try :
744- zitiIdJson = json .loads (zitiId )
745- except Exception as e :
746- print (f"ERROR: zitiId is not valid JSON: { e } " )
747- print (f"zitiId content: { zitiId } " )
748- exit (1 )
749-
750638 idFilename = "id.json"
751639 with open (idFilename , 'w' ) as f :
752640 f .write (zitiIdJson )
@@ -776,7 +664,7 @@ def generate_json_schema(obj, max_depth=10, current_depth=0):
776664
777665 # Load the identity for Ziti operations
778666 try :
779- openziti .load (idFilename )
667+ openziti .load (zitiIdJson )
780668 except Exception as e :
781669 print (f"ERROR: Failed to load Ziti identity: { e } " )
782670 print (f"DEBUG: INPUT_ZITIID hint: { _safe_hint (os .getenv ('INPUT_ZITIID' ))} " )
0 commit comments