File tree Expand file tree Collapse file tree
skills/rhdh-templates/scripts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,10 +110,20 @@ def main() -> int:
110110 raise ValueError ("--secrets file must contain a JSON object" )
111111 secrets = {str (k ): str (v ) for k , v in raw .items ()}
112112
113- skeleton_dir = args .skeleton_dir or (template_dir / "skeleton" )
114113 directory_contents : list [dict [str , str ]] = []
115- if skeleton_dir .is_dir ():
116- directory_contents = load_directory_contents (skeleton_dir )
114+ content_root = args .skeleton_dir or template_dir
115+ if content_root .is_dir ():
116+ if args .skeleton_dir :
117+ prefix = content_root .relative_to (template_dir ).as_posix ()
118+ for item in load_directory_contents (content_root ):
119+ directory_contents .append (
120+ {
121+ "path" : f"{ prefix } /{ item ['path' ]} " ,
122+ "base64Content" : item ["base64Content" ],
123+ }
124+ )
125+ else :
126+ directory_contents = load_directory_contents (content_root )
117127
118128 response = dry_run (
119129 args .rhdh_url ,
Original file line number Diff line number Diff line change @@ -29,10 +29,14 @@ def _rhdh_url() -> str | None:
2929
3030
3131def _rhdh_reachable (url : str ) -> bool :
32+ headers = {"Accept" : "application/json" }
33+ token = os .environ .get ("RHDH_TOKEN" ) or os .environ .get ("BACKSTAGE_TOKEN" )
34+ if token :
35+ headers ["Authorization" ] = f"Bearer { token } "
3236 try :
3337 req = urllib .request .Request (
3438 f"{ url .rstrip ('/' )} /api/scaffolder/v2/actions" ,
35- headers = { "Accept" : "application/json" } ,
39+ headers = headers ,
3640 method = "GET" ,
3741 )
3842 with urllib .request .urlopen (req , timeout = 5 ) as resp :
You can’t perform that action at this time.
0 commit comments