From be4a20f87715508f5a8ead4c99cae9968b327a63 Mon Sep 17 00:00:00 2001 From: Cedric Vidal Date: Sat, 14 Dec 2024 05:41:21 +1100 Subject: [PATCH] Lab script fetch track fork (#296) * git fetch origin * Add track origin main step --- docs/workshop/lab_setup.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/workshop/lab_setup.py b/docs/workshop/lab_setup.py index 79243d51..3f1db939 100755 --- a/docs/workshop/lab_setup.py +++ b/docs/workshop/lab_setup.py @@ -74,6 +74,24 @@ def fork_repository(): out, err = process.communicate() print(out) +@step("Fetch Origin") +def fetch_origin(): + """ + Fetch the latest changes from origin. + + Necessary because after forking repository, origin has not been fetched. + """ + subprocess.run(['git', 'fetch', 'origin'], check=True) + +@step("Track origin/main") +def track_origin_main(): + """ + Set the main branch to track origin/main instead of upstream/main + + Necessary because after forking repository, main is still tracking upstream. + """ + subprocess.run(['git', 'branch', 'main', '--set-upstream-to', 'origin/main'], check=True) + @step("Azure CLI Authentication") def azure_login(*, username: str = None, password: str = None, tenant: str = None, force: bool = False): # Only check authentication status if not forcing re-auth