trigger:
  branches:
    include: ['master']
pr: none

jobs:
  - job: ExplorationMerge
    pool:
      vmImage: Ubuntu-16.04
    steps:
      - task: NodeTool@0
        inputs:
          versionSpec: "10.15.1"

      - script: |
          set -e

          cat << EOF > ~/.netrc
          machine mssqltools.visualstudio.com
          login azuredatastudio
          password $(DEVOPS_PASSWORD)
          EOF

          git config user.email "andresse@microsoft.com"
          git config user.name "AzureDataStudio"

          git remote add explore "$ADS_EXPLORE_REPO"
          git fetch explore

          git checkout -b merge-branch explore/master

          git merge origin/master

          git push explore HEAD:master

        displayName: Sync & Merge Explore
        env:
          ADS_EXPLORE_REPO: $(ADS_EXPLORE_REPO)
          DEVOPS_PASSWORD: $(DEVOPS_PASSWORD)
