Search
Code212
console.log("Reading processed posts from Gist..."); const response = await axios.get( `https://api.github.com/gists/${GIST_CONFIG.gistId}`, { headers: { const content = JSON.stringify([...processedPosts]); await axios.patch( `https://api.github.com/gists/${GIST_CONFIG.gistId}`, { files: {
} const url = `https://api.github.com/graphql`; const query = ` query {
// GitHub search API to find trending repositories const query = encodeURIComponent("language:javascript language:typescript topic:react created:>2023-01-01"); const response = await fetch(`https://api.github.com/search/repositories?q=${query}&sort=stars&order=desc&per_page=5`, { headers: { "Accept": "application/vnd.github.v3+json",
): Promise<GitHubSearchResponse> { const url = `https://api.github.com/search/repositories?q=topic:${topic}&sort=stars&order=desc&page=${page}&per_page=${perPage}`; const headers: HeadersInit = {
// GitHub API clientexport class GitHubClient { private baseUrl = 'https://api.github.com'; private token: string;
while (hasMorePages) { const url = `https://api.github.com/repos/${owner}/${repo}/commits?since=${sinceISO}&until=${untilISO}&per_page=100&page=${page}`; console.log(`Fetching page ${page}...`); prNumber: number,): Promise<GitHubPR | null> { const url = `https://api.github.com/repos/${owner}/${repo}/pulls/${prNumber}`; const response = await fetch(url, { commitSha: string,): Promise<GitHubPR[]> { const url = `https://api.github.com/repos/${owner}/${repo}/commits/${commitSha}/pulls`; const response = await fetch(url, { // If we have a PR number, check for issues closed by the PR if (prNumber) { const prIssuesUrl = `https://api.github.com/repos/${owner}/${repo}/pulls/${prNumber}/commits`; const prResponse = await fetch(prIssuesUrl, { // Also check the timeline of the PR to find linked issues if (prNumber) { const timelineUrl = `https://api.github.com/repos/${owner}/${repo}/issues/${prNumber}/timeline`; const timelineResponse = await fetch(timelineUrl, {
// Get PR details const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}`; let response; // Proceed with merge const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}/merge`; const response = await fetch(url, {
try { const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}`; const response = await fetch(url, {
} const url = `https://api.github.com/repos/${repo}/issues/${issueNumber}`; const response = await fetch(url, { try { const url = `https://api.github.com/repos/${repo}/issues/${prNumber}/labels`; const response = await fetch(url, {
try { const url = `https://api.github.com/repos/${repo}/issues/${prNumber}/assignees`; const response = await fetch(url, {