Created
June 2, 2019 21:19
-
-
Save chadmayfield/a9dd44781eba1c0d89dcdfa1ac4f52a3 to your computer and use it in GitHub Desktop.
Check version of a Github project and email (using cron)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# check_version.sh - check github project for latest release version from cron & email | |
url="https://github.com/USER/REPO/releases/latest" | |
txt="/tmp/release.txt" | |
prj="$(echo $url | awk -F "/" '{print $4 "/" $5}')" | |
cmd="$(curl -sL -o /dev/null -w "%{url_effective}" ${url} | awk -F "/" '{print $NF}')" | |
if [ ! -f "$txt" ]; then | |
echo -n "Latest release: " | |
echo "$cmd" | tee "$txt" | |
else | |
if ! [[ "$cmd" =~ $(cat $txt) ]]; then | |
# TODO: add send email command | |
echo -n "Different versions send email! Repo $prj new version: " | |
echo "$cmd" | tee "$txt" | |
fi | |
fi | |
#EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment