You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/image-url.jpg?q=api&page=38&format=json
For typeahead suggestions, use the /typeahead
endpoint:
https://codesearch.val.run/typeahead?q=api
Returns an array of strings in format "username" or "username/projectName"
Found 11820 results for "api"(891ms)
222223try {
224const response = await fetch("/api/share", {
225method: "POST",
226headers: {
26let hasMorePages = true;
2728// GitHub API headers
29const headers = {
30"Accept": "application/vnd.github.v3+json",
31"Authorization": `Bearer ${token}`,
32"User-Agent": "GitHub-Release-Notes-Generator",
33"X-GitHub-Api-Version": "2022-11-28",
34};
3539while (hasMorePages) {
40const url =
41`https://api.github.com/repos/${owner}/${repo}/commits?since=${sinceISO}&until=${untilISO}&per_page=100&page=${page}`;
42console.log(`Fetching page ${page}...`);
4346if (!response.ok) {
47const error = await response.text();
48throw new Error(`GitHub API error: ${response.status} - ${error}`);
49}
5077prNumber: number,
78): Promise<GitHubPR | null> {
79const url = `https://api.github.com/repos/${owner}/${repo}/pulls/${prNumber}`;
8081const response = await fetch(url, {
84"Authorization": `Bearer ${token}`,
85"User-Agent": "GitHub-Release-Notes-Generator",
86"X-GitHub-Api-Version": "2022-11-28",
87},
88});
94if (!response.ok) {
95const error = await response.text();
96throw new Error(`GitHub API error: ${response.status} - ${error}`);
97}
98109commitSha: string,
110): Promise<GitHubPR[]> {
111const url = `https://api.github.com/repos/${owner}/${repo}/commits/${commitSha}/pulls`;
112113const response = await fetch(url, {
116"Authorization": `Bearer ${token}`,
117"User-Agent": "GitHub-Release-Notes-Generator",
118"X-GitHub-Api-Version": "2022-11-28",
119},
120});
126if (!response.ok) {
127const error = await response.text();
128throw new Error(`GitHub API error: ${response.status} - ${error}`);
129}
130133134/**
135* Fetches issues referenced by a commit or PR using GitHub API
136*/
137async function fetchIssueReferences(
147// If we have a PR number, check for issues closed by the PR
148if (prNumber) {
149const prIssuesUrl = `https://api.github.com/repos/${owner}/${repo}/pulls/${prNumber}/commits`;
150151const prResponse = await fetch(prIssuesUrl, {
154"Authorization": `Bearer ${token}`,
155"User-Agent": "GitHub-Release-Notes-Generator",
156"X-GitHub-Api-Version": "2022-11-28",
157},
158});
161const prCommits = await prResponse.json();
162163// Extract issue numbers from commit messages using the GitHub API pattern
164for (const commit of prCommits) {
165// Look for "Fixes #X", "Closes #X", "Resolves #X" patterns that GitHub recognizes
180// Also check the timeline of the PR to find linked issues
181if (prNumber) {
182const timelineUrl = `https://api.github.com/repos/${owner}/${repo}/issues/${prNumber}/timeline`;
183184const timelineResponse = await fetch(timelineUrl, {
187"Authorization": `Bearer ${token}`,
188"User-Agent": "GitHub-Release-Notes-Generator",
189"X-GitHub-Api-Version": "2022-11-28",
190},
191});
213* Fetches commits and their associated PRs
214* Includes progress tracking for large repositories
215* Uses GitHub API to find PR and issue references
216*/
217export async function fetchCommitsWithPRs(
231232// Process commits in batches to not get rate limited
233const BATCH_SIZE = 5; // Reduced batch size since we're making more API calls per commit
234for (let i = 0; i < commits.length; i += BATCH_SIZE) {
235const batch = commits.slice(i, i + BATCH_SIZE);
236const batchPromises = batch.map(async (commit) => {
237// Use GitHub API to find associated PRs for this commit
238const associatedPRs = await fetchPRsForCommit(token, owner, repo, commit.sha);
239245pr = associatedPRs[0]; // Use the first PR if multiple exist
246247// Get issue references using the GitHub API
248const prIssueRefs = await fetchIssueReferences(token, owner, repo, commit.sha, pr.number);
249issueRefs = [...prIssueRefs];