Merge pull request #16 from i-Cell-Mobilsoft-Open-Source/foundation #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync Repos | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'tokens/**' | |
- '!.github/workflows/**' | |
env: | |
GIT_PAT: ${{ secrets.GIT_PAT }} | |
jobs: | |
sync-repo: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
repo: [ids-core-web, ids-core-android, ids-core-ios] | |
name: Sync ${{ matrix.repo }} Repository | |
steps: | |
- name: Checkout core-foundation repository | |
uses: actions/checkout@v4 | |
with: | |
repository: i-Cell-Mobilsoft-Open-Source/ids-core-foundation | |
ref: main | |
fetch-depth: 0 | |
- name: Set up Git authentication for target repository | |
run: | | |
git config --global user.name "icellmobilsoft-robot" | |
git config --global user.email "[email protected]" | |
git clone https://x-access-token:[email protected]/i-Cell-Mobilsoft-Open-Source/${{ matrix.repo }}.git | |
- name: Merge core-foundation tokens into target main | |
run: | | |
cd ${{ matrix.repo }} | |
# Fetch changes from target main | |
git checkout main | |
git pull origin main | |
# Add core-foundation as a remote and fetch its changes | |
git remote add foundation https://x-access-token:[email protected]/i-Cell-Mobilsoft-Open-Source/ids-core-foundation.git | |
git fetch foundation | |
# Create a temporary branch to perform the merge | |
git checkout -b temp-merge | |
# Merge only the tokens directory from core-foundation/main | |
git checkout foundation/main -- tokens | |
# Stage the changes | |
git add tokens | |
# Commit the changes | |
git commit -m "Merged tokens directory from core-foundation into ${{ matrix.repo }}" | |
# Checkout main branch and merge the temporary branch | |
git checkout main | |
git merge temp-merge | |
# Push the merged changes back to target main | |
git push origin main | |
# Clean up the temporary branch | |
git branch -d temp-merge | |