Conditional cron job not working

The last part of my .travis.yml file is as follows:
- if [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then sh; else echo "Not cron. Skipping push to GitHub"; fi

I have set up the cronjob to run every week but even though it runs, the after_sucess part does not run the bash script and prints out Not cron.....
How do I solve this?

My repo is on