Skip to content
Merged
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
12 changes: 10 additions & 2 deletions src/data/live-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ const cache = new Map<string, Promise<string | null>>();

async function fetchStage(repo: string, plan: string): Promise<string | null> {
try {
const url = `https://raw.githubusercontent.com/pegma-dev/${repo}/main/${plan}`;
const res = await fetch(url, { signal: AbortSignal.timeout(10_000) });
const url = new URL(`https://api.github.com/repos/pegma-dev/${repo}/contents/${plan}`);
url.searchParams.set('ref', 'main');
const res = await fetch(url, {
cache: 'no-store',
headers: {
Accept: 'application/vnd.github.raw',
'User-Agent': 'pegma-dev-status-build',
},
Comment on lines +17 to +20

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Authenticate the contents API requests

Each CI build now sends nine unauthenticated GitHub REST requests, but unauthenticated traffic is limited to 60 requests per hour per source IP; hosted runners share source IPs, so an exhausted quota makes these requests return 403. Because fetchStage silently converts those responses to null, the production or preview build then publishes the hand-written now values rather than the source plans. Pass an authenticated token from the workflow or retain an endpoint that does not consume the REST API quota.

AGENTS.md reference: AGENTS.md:L28-L30

Useful? React with 👍 / 👎.

signal: AbortSignal.timeout(10_000),
});
Comment on lines +15 to +22
Comment on lines +13 to +22
if (!res.ok) return null;
const text = await res.text();
// The house style opens with "## Status" (or "## Current Status") whose
Expand Down