INNER CODE UNIT · TypeScript

fetchGitHubDirectory

winstonkoh87/Athena-Public · supabase/functions/sync-athena/index.ts:53

async function fetchGitHubDirectory(path: string): Promise<GitHubFile[]> {
  const url = `https://api.github.com/repos/${GITHUB_OWNER}/${GITHUB_REPO}/contents/${path}?ref=${GITHUB_BRANCH}`;
  
  const response = await fetch(url, {
    headers: {
      Authorization: `Bearer ${GITHUB_TOKEN}`,
      Accept: "application/vnd.github.v3+json",
    },
  });

  if (!response.ok) {
    throw new Error(`GitHub API error: ${response.statusText}`);
  }

  return await response.json();
}

// Fetch file content from GitHub

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…