Create GitHub Pull Requests Feed
User Intent
Operation
Code Example (TypeScript)
import { Graphlit } from 'graphlit-client';
import {
FeedTypes,
FeedServiceTypes,
GitHubPullRequestsFeedPropertiesInput,
GitHubPullRequestAuthenticationTypes,
GitHubRepositoriesInput,
} from 'graphlit-client/dist/generated/graphql-types';
const graphlit = new Graphlit();
// Use the GitHub credential stored in the Developer Portal
const authorizationId = process.env.GRAPHLIT_GITHUB_AUTH_ID!;
const repositoriesInput: GitHubRepositoriesInput = {
authenticationType: GitHubPullRequestAuthenticationTypes.OAuth,
authorizationId,
};
// Enumerate repositories this credential can access
const repositoriesResponse = await graphlit.queryGitHubRepositories(repositoriesInput);
const repositories = repositoriesResponse.githubRepositories?.results ?? [];
if (repositories.length === 0) {
throw new Error('No GitHub repositories available for the authorized account');
}
const { repositoryOwner, repositoryName } = repositories[0]!;
console.log(`Using GitHub repository: ${repositoryOwner}/${repositoryName}`);
const feed = await graphlit.createFeed({
name: 'Backend API Pull Requests',
type: FeedTypes.PullRequest,
pullRequest: {
type: FeedServiceTypes.GitHubPullRequests,
github: {
authorizationId,
authenticationType: GitHubPullRequestAuthenticationTypes.OAuth,
repositoryOwner: repositoryOwner!,
repositoryName: repositoryName!,
readLimit: 100,
},
},
// Optional: add workflow for content processing
// workflow: { id: workflow.createWorkflow.id }
});
console.log(`Created GitHub Pull Requests feed: ${feed.createFeed.id}`);Configuration
GitHub Token Setup
What Gets Synced
Use Cases
OAuth vs Personal Access Token
Metadata Structure
Filtering and Search
Related
Last updated