name: Sync to CNB

on:
  workflow_dispatch:
jobs:
  sync:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Sync to CNB Repository
        run: |
          docker run --rm \
            -v ${{ github.workspace }}:${{ github.workspace }} \
            -w ${{ github.workspace }} \
            -e PLUGIN_TARGET_URL="https://cnb.cool/dataease/sqlbot.git" \
            -e PLUGIN_AUTH_TYPE="https" \
            -e PLUGIN_USERNAME="cnb" \
            -e PLUGIN_PASSWORD=${{ secrets.CNB_PASSWORD }} \
            -e PLUGIN_FORCE=true \
            tencentcom/git-sync
