NetDiag GitHub Action | Multi-Region Health Checks in CI/CD

Run network diagnostics (DNS, TLS, HTTP, Ping) as part of your GitHub Actions workflows. Verify endpoint health after deployment with multi-region checks.

GH
netdiag-check Marketplace

Run multi-region health checks in GitHub Actions workflows

Installation

Add the action to your workflow file (.github/workflows/*.yml):

- name: Check endpoint health
  uses: XAKPC-Dev-Labs/netdiag-check@v1.0.1
  with:
    target: example.com
    api-key: $

Version Pinning: Pin to a specific version (@v1.0.1) for stability, or use @v1 to automatically get the latest v1.x release.


Quick Start

Here's a complete workflow that deploys your application and verifies it's healthy:

name: Deploy and Verify

on:
  push:
    branches: [main]

jobs:
  deploy-and-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Deploy to production
        run: ./deploy.sh

      - name: Wait for deployment
        run: sleep 30

      - name: Verify endpoint health
        uses: XAKPC-Dev-Labs/netdiag-check@v1.0.1
        with:
          target: example.com
          api-key: $

The action will:

  1. Run DNS, TLS, HTTP, and ping checks from 3 global regions
  2. Return an overall health status
  3. Pass if status is Healthy or Warning
  4. Fail the workflow if status is Unhealthy

Configuration Reference

Inputs

Input Required Default Description
target Yes Target hostname or URL to check
api-key No NetDiag API key for higher rate limits
regions No All regions Comma-separated region codes (us-west, eu-central, ap-southeast)
port No 443 TCP port for TLS/HTTP checks (80, 443, 8080, 8443)
timeout No 30 Request timeout in seconds

Outputs

Output Description
status Overall health status (Healthy, Warning, or Unhealthy)
quorum Count of healthy regions (e.g., "3/3")
dns-propagation DNS consistency across regions (consistent or mismatched)
json Full JSON response for custom processing

Status Outcomes

Status Meaning Workflow Result
Healthy All checks passed across all regions Workflow continues
Warning Service is working but has issues (e.g., TLS cert expiring soon) Workflow continues
Unhealthy Critical failure detected (DNS not resolving, HTTP errors, etc.) Workflow fails

Use Cases & Examples

name: Deploy and Verify

on: push: branches: [main]

jobs: deploy-and-check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4

- name: Deploy to production run: ./deploy.sh

- name: Wait for deployment run: sleep 30

- name: Verify endpoint health uses: XAKPC-Dev-Labs/netdiag-check@v1.0.1 with: target: example.com api-key: $

Verify your production deployment is healthy across all regions.

name: Scheduled Health Check

on: schedule: - cron: '0 * * * *' # Every hour

jobs: monitor: runs-on: ubuntu-latest steps: - name: Check production health uses: XAKPC-Dev-Labs/netdiag-check@v1.0.1 with: target: api.example.com api-key: $ timeout: 45

Run periodic health checks to monitor your production services.

name: PR Checks

on: pull_request: branches: [main]

jobs: verify-staging: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4

- name: Deploy to staging run: ./deploy-staging.sh env: PR_NUMBER: $

- name: Check staging environment uses: XAKPC-Dev-Labs/netdiag-check@v1.0.1 with: target: pr-$.staging.example.com api-key: $

Verify staging environments are healthy before merging pull requests.

name: Multi-Region Verification

on: workflow_dispatch:

jobs: check-regions: runs-on: ubuntu-latest steps: - name: Check EU and US regions uses: XAKPC-Dev-Labs/netdiag-check@v1.0.1 with: target: example.com api-key: $ regions: us-west,eu-central port: 443 timeout: 60

Target specific regions to verify regional deployments or CDN propagation.


Working with Outputs

You can access the action's outputs in subsequent workflow steps:

- name: Check endpoint health
  id: health-check
  uses: XAKPC-Dev-Labs/netdiag-check@v1.0.1
  with:
    target: example.com
    api-key: $

- name: Send Slack notification on failure
  if: steps.health-check.outputs.status != 'Healthy'
  uses: slackapi/slack-github-action@v1
  with:
    payload: |
      {
        "text": "Deployment health check failed!",
        "status": "$",
        "quorum": "$"
      }
  env:
    SLACK_WEBHOOK_URL: $

Parsing JSON Output

For advanced use cases, parse the full JSON response:

- name: Check endpoint health
  id: health-check
  uses: XAKPC-Dev-Labs/netdiag-check@v1.0.1
  with:
    target: example.com
    api-key: $

- name: Process detailed results
  run: |
    echo '$' | jq '.locations[] | select(.region == "us-west")'

API Key Setup

Why Use an API Key?

Free tier: 10 requests/minute (no API key required) With API key: Higher rate limits for CI/CD pipelines

Getting an API Key

Email netdiag@xakpc.dev to request an API key for your GitHub organization.

Configuring Secrets

  1. Go to your repository SettingsSecrets and variablesActions
  2. Click New repository secret
  3. Name: NETDIAG_API_KEY
  4. Value: Your API key
  5. Click Add secret

Use it in workflows:

with:
  api-key: $

Advanced Configuration

Custom Ports

Check non-standard ports (8080, 8443):

- name: Check custom port
  uses: XAKPC-Dev-Labs/netdiag-check@v1.0.1
  with:
    target: example.com
    port: 8443
    api-key: $

Timeout Adjustments

Increase timeout for slow-responding services:

- name: Check with extended timeout
  uses: XAKPC-Dev-Labs/netdiag-check@v1.0.1
  with:
    target: example.com
    timeout: 60  # Wait up to 60 seconds
    api-key: $

Matrix Strategy for Multiple Targets

Check multiple services in parallel:

name: Multi-Target Monitoring

on:
  schedule:
    - cron: '*/15 * * * *'  # Every 15 minutes

jobs:
  check-services:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        target:
          - api.example.com
          - cdn.example.com
          - status.example.com
    steps:
      - name: Check $
        uses: XAKPC-Dev-Labs/netdiag-check@v1.0.1
        with:
          target: $
          api-key: $

Troubleshooting

Rate Limiting

Error: 429 Too Many Requests

Solution: Add an API key to your workflow:

with:
  api-key: $

Timeout Issues

Error: Action times out or returns Unhealthy due to slow response

Solution: Increase the timeout value:

with:
  timeout: 60  # Increase from default 30 seconds

DNS Propagation Mismatches

Warning: dns-propagation: mismatched

Meaning: Different regions are resolving to different IP addresses (common during CDN updates or DNS changes).

Action: Wait for DNS to propagate globally, or verify this is expected behavior for your CDN setup.

Workflow Fails on Warning Status

By default, the action only fails on Unhealthy status. If you want to fail on Warning too:

- name: Check endpoint health
  id: health-check
  uses: XAKPC-Dev-Labs/netdiag-check@v1.0.1
  with:
    target: example.com
    api-key: $

- name: Fail on warning
  if: steps.health-check.outputs.status != 'Healthy'
  run: exit 1

Related