Automated sync from ga4dataform-model-dev #1
This file contains hidden or 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 | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source repository | |
| uses: actions/checkout@v3 | |
| - name: Push to destination repository | |
| run: | | |
| # Set Git user details | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "GitHub Action" | |
| # Clone the destination repository | |
| git clone https://${{ secrets.SYNC_WORKFLOW }}@github.com/superformlabs/ga4dataform.git destination-repo | |
| cd destination-repo | |
| # Add the source repository as a remote | |
| git remote add source-repo https://${{ secrets.SYNC_WORKFLOW }}@github.com/superformlabs/ga4dataform-model-dev.git | |
| # Fetch changes from source repository | |
| git fetch source-repo | |
| # Merge changes from source, excluding specific files | |
| git checkout source-repo/main -- . ':(exclude)includes/unit_tests/**' ':(exclude)definitions/core/unit_testing/**' | |
| # Commit changes (if any) | |
| git add . | |
| git diff-index --quiet HEAD || git commit -m "Automated sync from ga4dataform-model-dev" | |
| # Push changes to the destination repository | |
| git push origin main | |