This project is an automation tool to fetch and summarize a GitHub user's contributions to a specific organization within a defined time period. It then updates a Notion page with the contribution summary.
The project consists of several TypeScript files, each serving a different purpose:
github.ts
: Fetches contributions of a GitHub user.index.ts
: The main entry point of the application. It sets up the necessary configurations and clients for GraphQL, Langchain's OpenAI, and Notion. It also triggers the main function to fetch and post updates.langchain.ts
: Uses the Langchain LLM (Language Learning Model) service to generate a summary of contributions.logger.ts
: Sets up the logging service for the application.notion.ts
: Handles the Notion API interactions.types.ts
: Defines the data types used across the application.
The main features of the app are:
- Fetching GitHub user contributions data via the GitHub GraphQL API.
- Summarizing the contribution data into a concise and readable format using an AI model from Langchain.
- Updating a Notion page with the summarized contribution data.
The application requires several environment variables:
GITHUB_TOKEN
: GitHub API token.OPENAI_API_KEY
: API key for Langchain's LLM service.NOTION_API_KEY
: API key for Notion.NOTION_DATABASE_ID
: ID of the Notion database containing the GitHub usernames.NOTION_UPDATES_BLOCK_ID
: ID of the Notion block where the updates are to be posted.GITHUB_ORG_NAME
: GitHub organization name.
Once the environment variables are set, you can utilize the npm scripts to run the application and manage its lifecycle:
npm start
: Runs the application.npm run build
: Builds the application by transpiling the TypeScript source files to JavaScript using the TypeScript compiler.npm run lint
: Lints the TypeScript source files using ESLint.
This project has the following dependencies:
@octokit/graphql
: GitHub GraphQL client.@notionhq/client
: Notion API client.dotenv
: Load environment variables from a.env
file.pino
andpino-pretty
: Logging library and pretty-printing add-on.langchain/llms/openai
: Langchain's LLM service client.
Contributions are welcome. Feel free to open issues if you find any.
This project is licensed under the MIT License.