get_repo.sh 937 B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. # figure out latest tag by calling MS update API
  3. if [ "$INSIDER" == "1" ]; then
  4. UPDATE_INFO=$(curl https://update.code.visualstudio.com/api/update/darwin/insider/lol)
  5. else
  6. UPDATE_INFO=$(curl https://update.code.visualstudio.com/api/update/darwin/stable/lol)
  7. fi
  8. export LATEST_MS_COMMIT=$(echo $UPDATE_INFO | jq -r '.version')
  9. export LATEST_MS_TAG=$(echo $UPDATE_INFO | jq -r '.name')
  10. echo "Got the latest MS tag: ${LATEST_MS_TAG} version: ${LATEST_MS_COMMIT}"
  11. if [ "$INSIDER" == "1" ]; then
  12. mkdir -p vscode; cd vscode
  13. git init ; git remote add origin https://github.com/Microsoft/vscode.git
  14. git fetch --depth 1 origin $LATEST_MS_COMMIT; git checkout FETCH_HEAD
  15. cd ..
  16. else
  17. git clone https://github.com/Microsoft/vscode.git --branch $LATEST_MS_TAG --depth 1
  18. fi
  19. # for GH actions
  20. if [[ $GITHUB_ENV ]]; then
  21. echo "LATEST_MS_COMMIT=$LATEST_MS_COMMIT" >> $GITHUB_ENV
  22. echo "LATEST_MS_TAG=$LATEST_MS_TAG" >> $GITHUB_ENV
  23. fi