Skip to content

feat: Add weekly GitHub PR report automation system#44

Open
Justinohallo wants to merge 1 commit into
mainfrom
feat/weekly-github-pr-report-automation
Open

feat: Add weekly GitHub PR report automation system#44
Justinohallo wants to merge 1 commit into
mainfrom
feat/weekly-github-pr-report-automation

Conversation

@Justinohallo
Copy link
Copy Markdown
Owner

Overview

This PR implements a complete weekly GitHub PR report automation system that fetches merged PRs from the bitcoin-builder repository, generates structured JSON and Markdown reports, and provides API endpoints and UI pages for viewing reports.

Features

  • GitHub Integration: Fetches merged PRs from the last 7 days using GitHub Search API
  • Automatic Categorization: Categorizes PRs as feature/fix/docs/refactor/other using labels and keyword heuristics
  • Report Generation: Generates both JSON and Markdown formatted reports
  • File Storage: Saves reports to /data/reports/ directory
  • Vercel Cron Integration: Automatically generates reports every Sunday at 5PM UTC
  • API Endpoints:
    • POST /api/weekly-report (authenticated, admin only) - Generate new report
    • GET /api/reports/latest (public) - Get latest report
  • UI Pages:
    • /reports - Listing page showing all available reports
    • /reports/[slug] - Individual report page with detailed breakdown

Changes

New Files

  • lib/github/fetchMergedPRs.ts - GitHub API integration
  • lib/reports/buildReport.ts - Report generation and categorization logic
  • lib/reports/saveReport.ts - File system operations for reports
  • app/api/weekly-report/route.ts - POST endpoint for report generation
  • app/api/reports/latest/route.ts - GET endpoint for latest report
  • app/reports/page.tsx - Reports listing page
  • app/reports/[slug]/page.tsx - Individual report page
  • scripts/run-weekly-report-local.sh - Local testing script
  • vercel.json - Vercel cron job configuration

Modified Files

  • package.json - Added date-fns dependency
  • lib/types.ts - Added report type definitions

Setup Required

  1. Add GITHUB_TOKEN environment variable (GitHub personal access token with repo read permissions)
  2. Reports will be automatically generated weekly via Vercel Cron
  3. Manual generation can be triggered via POST /api/weekly-report (requires admin authentication)

Testing

  • All TypeScript compilation passes
  • All linting checks pass
  • Local testing script available at scripts/run-weekly-report-local.sh

Documentation

Reports are saved in the format:

  • weekly-YYYY-MM-DD.json - Structured JSON data
  • weekly-YYYY-MM-DD.md - Formatted Markdown report

- Add date-fns dependency for date handling
- Create GitHub API integration to fetch merged PRs
- Implement report generation with categorization (feature/fix/docs/refactor/other)
- Add API endpoints for report generation and retrieval
- Create UI pages for viewing weekly reports
- Configure Vercel cron job for automatic weekly generation
- Add local testing script for manual report generation

API Routes:
- POST /api/weekly-report (authenticated, admin only)
- GET /api/reports/latest (public)

Pages:
- /reports (listing page)
- /reports/[slug] (individual report page)

Files saved to /data/reports/ directory
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Dec 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
bitcoin-builder Ready Ready Preview Comment Dec 3, 2025 11:25pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant