Backend

This directory contains the server-side code for the GitHub Release Notes Generator.

Files

  • github.ts - GitHub API integration for fetching commits and PR data
  • llm.ts - OpenAI integration for generating release notes
  • types.ts - Type definitions for the backend

API Endpoints

POST /api/commits

Fetches commits and associated PR data from GitHub within a specified date range.

Request Body:

{ "token": "github_personal_access_token", "owner": "repository_owner", "repo": "repository_name", "startDate": "2023-01-01", "endDate": "2023-01-31" }

Response:

{ "commits": [ { "sha": "commit_sha", "message": "commit_message", "date": "commit_date", "author": "author_name", "authorUrl": "author_github_url", "commitUrl": "commit_url", "pr": { "number": 123, "title": "PR title", "description": "PR description", "url": "PR URL" } } ] }

POST /api/generate-notes

Generates user-facing release notes from commit and PR data using OpenAI.

Request Body:

{ "commits": [ // Array of commit objects from /api/commits ] }

Response:

{ "releaseNotes": { "notes": [ { "title": "Feature title", "description": "Feature description", "type": "feature", "originalCommits": ["commit_sha1", "commit_sha2"] } ], "markdown": "## Release Notes\n\n### Features\n- **Feature title**: Feature description" } }