Health Check #300
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: Health Check | |
on: | |
schedule: | |
- cron: '0 */6 * * *' # Runs every 6 hours | |
workflow_dispatch: | |
permissions: | |
issues: write | |
jobs: | |
health-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Install wget | |
run: sudo apt-get install -y wget | |
- name: Download Webpage | |
run: wget -O downloaded_index.html https://www.ozfoundation.com | |
- name: Compare with Local index.html | |
run: | | |
diff downloaded_index.html index.html | |
if [ $? -ne 0 ]; then | |
echo "Health check failed: The downloaded webpage does not match the local index.html" | |
exit 1 | |
else | |
echo "Health check passed: The downloaded webpage matches the local index.html" | |
fi | |
create-issue: | |
runs-on: ubuntu-latest | |
needs: health-check | |
if: failure() | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Create Issue | |
run: | | |
gh issue create --title "Health Check Failed" --body "The downloaded webpage does not match the local index.html. Please investigate the issue." --assignee gdsmith1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |