Check CODA VM #459
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: | |
# 12 PM UTC or 7 AM EST | |
- cron: 0 12 * * * | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: check issue body | |
run: | | |
export TODAY=`date +'%m/%d/%Y'` | |
echo TODAY=$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 ISSUE_BODY=$BODY | |
if [ $TODAY = $BODY ]; then | |
echo "CODA VM is running" | |
else | |
echo "CODA VM is not running" | |
MESSAGE='{"body":"@gkwan-ibm and @shin19991207, 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 | |