@@ -273,10 +273,31 @@ def ensure_git_exists():
273
273
git_executable = ensure_git_exists ()
274
274
parser , _ = init_argparse ()
275
275
276
+ if not parser .github_access_token .strip () and not (parser .github_app_id .strip () and parser .github_app_private_key .strip () and parser .github_app_installation_id .strip ()):
277
+ print ("You must supply the GitHub token, or the GitHub App ID and private key and installation ID" )
278
+ sys .exit (1 )
279
+
280
+ if not parser .template_repo_name .strip ():
281
+ print ("You must supply the upstream (or template) repo" )
282
+ sys .exit (1 )
283
+
284
+ if not parser .tenant_name .strip () and not parser .new_repo_name_prefix .strip ():
285
+ print ("You must define the new repo prefix or run this script against a tenant" )
286
+ sys .exit (1 )
287
+
276
288
# The access token is generated from a github app or supplied directly as an access token
277
289
token = generate_github_token (parser .github_app_id , parser .github_app_private_key ,
278
290
parser .github_app_installation_id ) if len (
279
291
parser .github_access_token .strip ()) == 0 else parser .github_access_token .strip ()
292
+
293
+ # The process followed here is:
294
+ # 1. Verify the manually supplied upstream repo exists
295
+ # 2. Build the name of the new downstream repo with a prefix and the new project name.
296
+ # a. The prefix is either specified or assumed to be the name of a tenant
297
+ # b. The new project name is either specified or assumed to be the same as the upstream project name
298
+ # 3. Create a new downstream repo if it doesn't exist
299
+ # 4. Fork the upstream repo into the downstream repo with a hard git reset
300
+
280
301
cac_org = parser .git_organization .strip ()
281
302
template_repo = parser .template_repo_name .strip ()
282
303
new_repo_custom_prefix = re .sub ('[^a-zA-Z0-9]' , '_' , parser .new_repo_name_prefix .strip ())
0 commit comments