DocumentationGitHub API

GitHub API

Proxy requests to GitHub API securely.

Proxy requests to GitHub API to fetch private repository data.

api/fuseplane/github-repos.ts
1import { FusePlaneEndpoint } from '@fuseplane/core';
2
3export default FusePlaneEndpoint({
4 async run({ secrets }) {
5 const response = await fetch('https://api.github.com/user/repos', {
6 headers: {
7 'Authorization': `token ${secrets.GITHUB_TOKEN}`,
8 'Accept': 'application/vnd.github.v3+json'
9 }
10 });
11
12 const repos = await response.json();
13
14 // Transform data before sending to client
15 return repos.map(repo => ({
16 name: repo.name,
17 stars: repo.stargazers_count,
18 url: repo.html_url
19 }));
20 }
21});