Check CODA VM #23
This file contains 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
name: Check CODA VM | |
on: | |
workflow_dispatch: | |
schedule: | |
# 6 AM UTC or 1 AM EST | |
- cron: 0 6 * * * | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: check issue body | |
run: | | |
export TODAY=`date +'%m/%d/%Y'` | |
echo $TODAY | |
BODY=`curl -s -L \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.MY_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/GuidesBot/dependCheckForGuides/issues/876 \ | |
| grep body | awk -F '"' '/body/ {print $4}'` | |
echo $BODY | |
if [ $TODAY = $BODY ]; then | |
echo "CODA VM is running" | |
else | |
echo "CODA VM is not running" | |
MESSAGE='{"body":"@gkwan-ibm and @Ruilin-Ma, CODA VM is down on '$TODAY'!"}' | |
echo "$MESSAGE" | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.MY_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/GuidesBot/dependCheckForGuides/issues/876/comments \ | |
-d "$MESSAGE" | |
fi | |