Node Health Check #1221
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
| name: Node Health Check | |
| on: | |
| schedule: | |
| # Run every 6 hours | |
| - cron: "0 */6 * * *" | |
| workflow_dispatch: | |
| # Allow manual triggering | |
| permissions: | |
| contents: write | |
| actions: read | |
| jobs: | |
| health-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python 3 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.13" | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt update | |
| sudo apt install -y curl netcat-openbsd iputils-ping | |
| - name: Make script executable | |
| run: sudo chmod +x scripts/check-status.py | |
| - name: Run health check | |
| run: | | |
| cd "${{ github.workspace }}" | |
| python3 scripts/check-status.py --debug | |
| - name: Check if report was generated | |
| id: check_report | |
| run: | | |
| if [ -f "node-report.md" ]; then | |
| echo "report_exists=true" >> $GITHUB_OUTPUT | |
| echo "Report file exists" | |
| else | |
| echo "report_exists=false" >> $GITHUB_OUTPUT | |
| echo "Report file not found" | |
| fi | |
| - name: Publish report to checker branch | |
| if: steps.check_report.outputs.report_exists == 'true' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| run: | | |
| publish_dir=$(mktemp -d) | |
| cp node-report.md "${publish_dir}/node-report.md" | |
| cd "${publish_dir}" | |
| git init | |
| git checkout -b checker | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add node-report.md | |
| git commit -m "chore(health): update node health status report" | |
| git push --force "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" checker | |
| - name: Upload report as artifact | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: node-health-report-${{ github.run_number }} | |
| path: node-report.md | |
| retention-days: 30 |