Skip to content

Commit 4fe2c4f

Browse files
UltraDAGcomClaude Opus 4.6 (1M context)
andcommitted
Fix bounty detection: match by [BOUNTY] title prefix, not just label
The bounty label didn't exist in the repo, so issues created via the "+ Post Bounty" link weren't found. Now fetches all recent issues and filters client-side by either: - bounty/bounty:*/bug-bounty label - [BOUNTY] prefix in the issue title Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5a6a340 commit 4fe2c4f

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

dashboard/src/lib/github.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,26 +149,39 @@ let cachedIssues: GitHubIssue[] = [];
149149
let cacheTime = 0;
150150
let lastRateLimit: number | null = null;
151151

152+
function isBountyIssue(issue: GitHubIssue): boolean {
153+
// Match by label (bounty, bounty:*, bug-bounty)
154+
const hasLabel = issue.labels.some(l =>
155+
l.name.toLowerCase() === 'bounty' || l.name.toLowerCase().startsWith('bounty:') || l.name.toLowerCase() === 'bug-bounty'
156+
);
157+
// Match by title prefix [BOUNTY]
158+
const hasTitle = /^\[BOUNTY\]/i.test(issue.title);
159+
return hasLabel || hasTitle;
160+
}
161+
152162
export async function fetchBountyIssues(): Promise<{ issues: GitHubIssue[]; rateLimitRemaining: number | null }> {
153163
if (Date.now() - cacheTime < CACHE_TTL_MS && cachedIssues.length > 0) {
154164
return { issues: cachedIssues, rateLimitRemaining: lastRateLimit };
155165
}
156166

157-
const url = `${API_BASE}/repos/${REPO}/issues?labels=bounty&state=all&per_page=100&sort=updated&direction=desc`;
167+
// Fetch all recent issues and filter client-side for bounties.
168+
// This catches both label-based and title-based bounty detection,
169+
// since the 'bounty' label may not exist in the repo yet.
170+
const url = `${API_BASE}/repos/${REPO}/issues?state=all&per_page=100&sort=updated&direction=desc`;
158171
const res = await fetch(url, { signal: AbortSignal.timeout(10000) });
159172

160173
lastRateLimit = res.headers.get('X-RateLimit-Remaining') ? parseInt(res.headers.get('X-RateLimit-Remaining')!) : null;
161174

162175
if (res.status === 403) {
163-
// Rate limited — return cached data
164176
return { issues: cachedIssues, rateLimitRemaining: 0 };
165177
}
166178

167179
if (!res.ok) {
168180
throw new Error(`GitHub API error: ${res.status}`);
169181
}
170182

171-
const issues: GitHubIssue[] = await res.json();
183+
const allIssues: GitHubIssue[] = await res.json();
184+
const issues = allIssues.filter(isBountyIssue);
172185
cachedIssues = issues;
173186
cacheTime = Date.now();
174187

0 commit comments

Comments
 (0)