invoke-copybara 780 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. KNOWN_HOSTS=/root/.ssh/known_hosts
  3. if [[ "$BRANCH_NAME" == "master" && "$COPYBARA" == "run" ]]; then
  4. set -e
  5. chmod -R 0600 /root/.ssh
  6. ssh-keyscan github.com > $KNOWN_HOSTS
  7. ssh-keygen -lf $KNOWN_HOSTS | grep "SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8 github.com"
  8. git config --global user.name Copybot
  9. git config --global user.email copybot@overleaf.com
  10. set +e
  11. copybara --git-committer-email=copybot@overleaf.com --git-committer-name=Copybot
  12. COPYBARA_EXIT_CODE=$?
  13. # Exit codes are documented in java/com/google/copybara/util/ExitCode.java
  14. # 0 is success, 4 is no-op (i.e. no change), anything else is an error
  15. if [[ $COPYBARA_EXIT_CODE -eq 0 || $COPYBARA_EXIT_CODE -eq 4 ]]; then
  16. exit 0
  17. else
  18. exit $COPYBARA_EXIT_CODE
  19. fi
  20. fi