Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/health-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Health Check

on:
schedule:
- cron: '0 */6 * * *'
workflow_dispatch:

jobs:
ping-health:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Ping Health Endpoint
id: ping
run: |
status=$(curl -sf -o /dev/null -w "%{http_code}" https://stepfi-api.onrender.com/api/v1/health || echo "failed")
echo "status=$status" >> "$GITHUB_OUTPUT"

- name: Handle Failure
if: steps.ping.outputs.status != '200'
uses: actions/github-script@v7
with:
script: |
const status = '${{ steps.ping.outputs.status }}';
const timestamp = new Date().toISOString();
const issueTitle = `Health check failed at ${timestamp}`;
const issueBody = `The health check endpoint returned HTTP status ${status}.`;
const label = 'incident';

const { data: issues } = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: label
});

if (issues.length > 0) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issues[0].number,
body: `Health check failed again at ${timestamp} with HTTP status ${status}.`
});
console.log(`Commented on existing incident issue #${issues[0].number}`);
} else {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: issueTitle,
body: issueBody,
labels: [label]
});
console.log('Created new incident issue');
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ The bootstrap command will guide you through the process of setting up a Supabas
| **Swagger Docs** | https://stepfi-api.onrender.com/api/v1/docs |
| **Health Check** | https://stepfi-api.onrender.com/api/v1/health |

> **Note**: A GitHub Action workflow pings the Health Check URL every 6 hours to keep the Render free tier instance warm and acts as a heartbeat monitor. If the ping fails (non-200 response), it automatically creates or updates a GitHub issue with the `incident` label to alert maintainers.
## 🛠️ Error tracking

Error tracking is powered by Sentry. To enable error tracking in development or production:
Expand Down
5 changes: 5 additions & 0 deletions context/progress-tracker.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ pure chore/docs commits). Direct pushes to main must also be logged here.

---

## 2026-07-23

- Added GitHub Actions health check workflow (`health-check.yml`) to ping the Render API every 6 hours to prevent the free tier instance from sleeping. Auto-creates or comments on issues with the `incident` label if the ping fails, preventing silent outages.
- Documented the ping URL and incident label in README.

## 2026-07-19

- Wired `LiquidityContractClient` (restored under `src/blockchain/contracts/liquidity-contract.client.ts`) into `LiquidityService` constructor.
Expand Down
Loading