From a265047188afb078c17933e5ecba2be23992c3f6 Mon Sep 17 00:00:00 2001 From: Roman Bredehoft Date: Wed, 5 Jun 2024 14:23:24 +0200 Subject: [PATCH] chore: replace action by custom implementation --- .github/workflows/sync_on_push.yaml | 48 +++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/.github/workflows/sync_on_push.yaml b/.github/workflows/sync_on_push.yaml index 4c25145b0d..a2f2b9ac56 100644 --- a/.github/workflows/sync_on_push.yaml +++ b/.github/workflows/sync_on_push.yaml @@ -12,20 +12,42 @@ jobs: if: ${{ github.repository == 'zama-ai/concrete-ml' }} runs-on: ubuntu-latest steps: - # - name: Checkout repo - # uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - # with: - # fetch-depth: 0 - # lfs: true + - name: Checkout repo + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + with: + fetch-depth: 0 + lfs: true + ref: "main" # Initial action can be found here: https://github.com/wei/git-sync # The issue is that it does not handle LFS files when pushing, so we had to fork it and # add the feature - - name: git-sync - uses: RomanBredehoft/git-sync@2e68fe0b118adbae6d9293ea7759227b8191e4af - with: - source_repo: "zama-ai/concrete-ml" - source_branch: "main" - destination_repo: "https://${{ secrets.BOT_USERNAME }}:${{ secrets.CONCRETE_ACTIONS_TOKEN }}@github.com/${{ secrets.SYNC_DEST_REPO }}.git" - destination_branch: "main" - push_lfs: true + # - name: git-sync + # uses: RomanBredehoft/git-sync@2e68fe0b118adbae6d9293ea7759227b8191e4af + # with: + # source_repo: "zama-ai/concrete-ml" + # source_branch: "main" + # destination_repo: "https://${{ secrets.BOT_USERNAME }}:${{ secrets.CONCRETE_ACTIONS_TOKEN }}@github.com/${{ secrets.SYNC_DEST_REPO }}.git" + # destination_branch: "main" + # push_lfs: true + + - name: Custom git-sync + run: | + SOURCE_BRANCH="main" + DESTINATION_BRANCH="main" + + SOURCE_REPO="https://github.com/zama-ai/concrete-ml.git" + DESTINATION_REPO="https://${{ secrets.BOT_USERNAME }}:${{ secrets.CONCRETE_ACTIONS_TOKEN }}@github.com/${{ secrets.SYNC_DEST_REPO }}.git" + + echo "SOURCE=$SOURCE_REPO:$SOURCE_BRANCH" + echo "DESTINATION=$DESTINATION_REPO:$DESTINATION_BRANCH" + + git remote add destination "$DESTINATION_REPO" + + echo "Push LFS files:" + # git lfs push destination "${SOURCE_BRANCH}:${DESTINATION_BRANCH}" + git lfs push destination --dry-run + + echo "Push remaining files:" + # git push destination "${SOURCE_BRANCH}:${DESTINATION_BRANCH}" -f + git push destination -f --dry-run