From 6ff5574071f35249d3c047bf5e00e075c60e16ca Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 13 Nov 2025 20:41:18 +0000 Subject: [PATCH 1/4] Sync from Java repo [automated] --- synced-from-java/test.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 synced-from-java/test.txt diff --git a/synced-from-java/test.txt b/synced-from-java/test.txt new file mode 100644 index 0000000..aef26c2 --- /dev/null +++ b/synced-from-java/test.txt @@ -0,0 +1 @@ +This is atest foile for testing synchronisation bewteen Java and Pyhton repositories. \ No newline at end of file From 8315650d040d822c4ab961ce5e4759cd3a9407bd Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 13 Nov 2025 20:50:49 +0000 Subject: [PATCH 2/4] Sync from Java repo [automated] --- synced-from-java/AnotherFile.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 synced-from-java/AnotherFile.txt diff --git a/synced-from-java/AnotherFile.txt b/synced-from-java/AnotherFile.txt new file mode 100644 index 0000000..d31a878 --- /dev/null +++ b/synced-from-java/AnotherFile.txt @@ -0,0 +1 @@ +This is another Text file for testing the synchronisation between the repositories. \ No newline at end of file From 39713b1f3bd42a9ea7df8ca45212c8fc2418ac0d Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Fri, 14 Nov 2025 20:34:12 +0000 Subject: [PATCH 3/4] Sync from Java repo [automated] --- synced-from-java/YetAnotherFile.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 synced-from-java/YetAnotherFile.txt diff --git a/synced-from-java/YetAnotherFile.txt b/synced-from-java/YetAnotherFile.txt new file mode 100644 index 0000000..ec03e99 --- /dev/null +++ b/synced-from-java/YetAnotherFile.txt @@ -0,0 +1 @@ +This is another file to test syncrinisation between Java-Python repo. \ No newline at end of file From 105fe5ea070ba9ab49c851ebfdc69ff7e0159469 Mon Sep 17 00:00:00 2001 From: Sikandar Ejaz <34721766+SikandarEjaz@users.noreply.github.com> Date: Fri, 14 Nov 2025 15:36:11 -0500 Subject: [PATCH 4/4] updated sync workflow --- .github/workflows/sync-from-java.yml | 35 ++++++++++++++++++---------- sync_folder/PythonFile.txt | 1 + 2 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 sync_folder/PythonFile.txt diff --git a/.github/workflows/sync-from-java.yml b/.github/workflows/sync-from-java.yml index ddb94b0..54ee9de 100644 --- a/.github/workflows/sync-from-java.yml +++ b/.github/workflows/sync-from-java.yml @@ -1,7 +1,12 @@ -name: Sync from Java Repo (Manual) +name: Sync to Java Repo on: - workflow_dispatch: + push: + branches: + - main + paths: + - 'sync_folder/**' # Only trigger when files in sync_folder change. More foldes and files can be added later. + workflow_dispatch: jobs: sync: @@ -11,24 +16,30 @@ jobs: uses: actions/checkout@v4 with: path: python-repo - + - name: Checkout Java Repo uses: actions/checkout@v4 with: repository: SikandarEjaz/RepoSyncTestJava token: ${{ secrets.SYNC_TOKEN }} path: java-repo - - - name: Sync files from Java + + - name: Sync files run: | - mkdir -p python-repo/synced-from-java - cp -r java-repo/sync_folder/* python-repo/synced-from-java/ - - - name: Commit and Push + # Copy files from Python repo to Java repo + mkdir -p java-repo/synced-from-python + # Check if sync_folder exists and has files + if [ -d "python-repo/sync_folder" ] && [ "$(ls -A python-repo/sync_folder)" ]; then + cp -r python-repo/sync_folder/* java-repo/synced-from-python/ + else + echo "sync_folder is empty or doesn't exist" + fi + + - name: Commit and Push to Java Repo run: | - cd python-repo + cd java-repo git config user.name "GitHub Action" git config user.email "action@github.com" git add . - git diff --quiet && git diff --staged --quiet || git commit -m "Manual sync from Java repo" - git push + git diff --quiet && git diff --staged --quiet || git commit -m "Sync from Python repo [automated]" + git push \ No newline at end of file diff --git a/sync_folder/PythonFile.txt b/sync_folder/PythonFile.txt new file mode 100644 index 0000000..8fb3cc5 --- /dev/null +++ b/sync_folder/PythonFile.txt @@ -0,0 +1 @@ +This is a file in Python repo for testing synchronisation with the Java repo. \ No newline at end of file