From 21b169ab112eba27cf4a60b053a433ede0a7a3f7 Mon Sep 17 00:00:00 2001
From: Sichan Yoo <chanyoo@amazon.com>
Date: Mon, 9 Dec 2024 14:33:10 -0800
Subject: [PATCH 1/2] Use git-sync instead of built-in GitHub workflows for
 syncing private mirror repo to public repo.

---
 .github/workflows/repo-sync.yml | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/.github/workflows/repo-sync.yml b/.github/workflows/repo-sync.yml
index 1d2923234..ecc802085 100644
--- a/.github/workflows/repo-sync.yml
+++ b/.github/workflows/repo-sync.yml
@@ -1,22 +1,21 @@
-name: Sync Staging Repo
+name: Sync Mirror
 
 on:
   push:
-    branches:
-      - main
+    branches: [ main ]
   workflow_dispatch:
 
 jobs:
-  sync:
+  git-sync:
     runs-on: ubuntu-latest
+
     steps:
-      - name: Checkout smithy-swift
-        uses: actions/checkout@v4
+      - name: git-sync
+        uses: wei/git-sync@v3
         with:
-          ref: main
-      - name: Add staging repo as remote with token
-        run: |
-          git remote add staging-repo https://${{ secrets.REPO_SYNC_AUTOMATION_USER_TOKEN }}@github.com/awslabs/private-smithy-swift-staging.git
-      - name: Push changes to staging repo
-        run: |
-          git push staging-repo main
+          source_repo: ${{ secrets.GIT_SYNC_SOURCE_REPO }}
+          source_branch: "main"
+          destination_repo: ${{ secrets.GIT_SYNC_DESTINATION_REPO }}
+          destination_branch: "main"
+          source_ssh_private_key: ${{ secrets.GIT_SYNC_SOURCE_SSH_PRIVATE_KEY }}
+          destination_ssh_private_key:  ${{ secrets.GIT_SYNC_DESTINATION_SSH_PRIVATE_KEY }}
\ No newline at end of file

From 9140b6744274075e90ccc629c077c1abe6e0248a Mon Sep 17 00:00:00 2001
From: Sichan Yoo <chanyoo@amazon.com>
Date: Thu, 12 Dec 2024 10:38:55 -0800
Subject: [PATCH 2/2] SSH key unnnecessary for public source repo; update
 GIT_SYNC_SOURCE_REPO to https link as well.

---
 .github/workflows/repo-sync.yml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.github/workflows/repo-sync.yml b/.github/workflows/repo-sync.yml
index ecc802085..a789c21b5 100644
--- a/.github/workflows/repo-sync.yml
+++ b/.github/workflows/repo-sync.yml
@@ -17,5 +17,4 @@ jobs:
           source_branch: "main"
           destination_repo: ${{ secrets.GIT_SYNC_DESTINATION_REPO }}
           destination_branch: "main"
-          source_ssh_private_key: ${{ secrets.GIT_SYNC_SOURCE_SSH_PRIVATE_KEY }}
           destination_ssh_private_key:  ${{ secrets.GIT_SYNC_DESTINATION_SSH_PRIVATE_KEY }}
\ No newline at end of file