test commit to check github workflow 06 #6
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 MDDB database | |
| on: | |
| push: | |
| paths: | |
| - 'src/mddb-database/**' | |
| branches: [ master ] | |
| jobs: | |
| sync-to-common-repo: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: master | |
| - name: Configure Git | |
| run: | | |
| git config user.name "CI Bot" | |
| git config user.email "ci@example.com" | |
| - name: Extract changes in MDDB database code | |
| id: split | |
| run: | | |
| # Make sure we are in the right commit | |
| echo "Current commit: $(git rev-parse HEAD)" | |
| echo "Current branch: $(git branch --show-current)" | |
| # Make sire the directory exists | |
| ls -la src/mddb-database/ || echo "Directory does not exist" | |
| # git subtree split extract only commits under src/mddb-database/ and creates a temporal branch with clean history | |
| SUBTREE_COMMIT=$(git subtree split --prefix=src/mddb-database) | |
| echo $SUBTREE_COMMIT | |
| echo "subtree_commit=$SUBTREE_COMMIT" >> $GITHUB_OUTPUT | |
| echo "📦 Extracted commit: $SUBTREE_COMMIT" | |
| - name: Push to MDDB database repo | |
| if: steps.split.outputs.subtree_commit != '' | |
| run: | | |
| git push https://x-access-token:${{ secrets.MDDB_DATABASE_WORKFLOWS_PAT }}@github.com/mmb-irb/mddb-database.git \ | |
| ${{ steps.split.outputs.subtree_commit }}:main --force | |
| echo "✅ MDDB database updated" |