Website Uptime Monitor to Discord #470
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: Website Uptime Monitor to Discord | |
on: | |
schedule: | |
- cron: '0 */6 * * *' # 6시간마다 실행 | |
jobs: | |
check-websites-and-notify: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check openstack-kr.org | |
id: openstack-kr | |
run: | | |
status_code=$(curl -o /dev/null -s -w "%{http_code}\n" http://openstack-kr.org) | |
echo "OPENSTACK_KR_STATUS=$status_code" >> $GITHUB_ENV | |
if [ "$status_code" -ne 200 ] && [ "$status_code" -ne 301 ]; then | |
echo "openstack_kr_down=true" >> $GITHUB_ENV | |
else | |
echo "openstack_kr_down=false" >> $GITHUB_ENV | |
fi | |
- name: Check openinfra-kr.org | |
id: openinfra-kr | |
run: | | |
status_code=$(curl -o /dev/null -s -w "%{http_code}\n" http://openinfra-kr.org) | |
echo "OPENINFRA_KR_STATUS=$status_code" >> $GITHUB_ENV | |
if [ "$status_code" -ne 200 ] && [ "$status_code" -ne 301 ]; then | |
echo "openinfra_kr_down=true" >> $GITHUB_ENV | |
else | |
echo "openinfra_kr_down=false" >> $GITHUB_ENV | |
fi | |
- name: Check forum.openinfra-kr.org | |
id: forum-openinfra-kr | |
run: | | |
status_code=$(curl -o /dev/null -s -w "%{http_code}\n" https://forum.openinfra-kr.org) | |
echo "FORUM_OPENINFRA_KR_STATUS=$status_code" >> $GITHUB_ENV | |
if [ "$status_code" -ne 200 ] && [ "$status_code" -ne 301 ]; then | |
echo "forum_openinfra_kr_down=true" >> $GITHUB_ENV | |
else | |
echo "forum_openinfra_kr_down=false" >> $GITHUB_ENV | |
fi | |
- name: Send notification to Discord if any website is down | |
if: env.openstack_kr_down == 'true' || env.openinfra_kr_down == 'true' || env.forum_openinfra_kr_down == 'true' | |
uses: "Ilshidur/action-discord@0.3.2" | |
with: | |
args: "One or more websites are down or redirected. Please check the logs for more details." | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} |