name: Git Pull on Main Push 1

on:
  push:
    branches:
      - main

jobs:
  git-pull:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Git Pull
        run: |
          mkdir -p ~/.ssh
          echo "$OVH_SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
          chmod 600 ~/.ssh/id_rsa
          echo "$OVH_SSH_PASSWORD" > ~/.ssh/password

          sshpass -e ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa -l $OVH_SSH_USERNAME $OVH_SSH_HOST 'cd DashboardNW && git pull origin main'
        env:
          OVH_SSH_HOST: ${{ secrets.OVH_SSH_HOST }}
          OVH_SSH_USERNAME: ${{ secrets.OVH_SSH_USERNAME }}
          OVH_SSH_PRIVATE_KEY: ${{ secrets.OVH_SSH_PRIVATE_KEY }}
          SSHPASS: ${{ secrets.OVH_SSH_PASSWORD }}
