This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a GitHub Action that generates Open Graph (OG) images from markdown files in pull requests. The action reads frontmatter configuration from .md/.mdx files and creates social media preview images using Puppeteer and a web component.
# Type checking
bun --bun tsc --noEmit
# Build for development
bun build src/main.ts --outdir dist --target node
# Build for release (compiled binary)
bun build src/main.ts --compile --outfile dist/index.js
# Run tests
bun test
# Format code
biome format --write- Uses Biome for formatting and linting with tab indentation and double quotes
- Pre-commit hooks run
biome check --writevia lefthook - Type checking with TypeScript
- Validates GitHub environment (PR context only)
- Gets repository configuration via
getRepoProps() - Finds markdown files in PR with
findFile() - For each file with OG config:
- Generates HTML template with
generateHtml() - Creates image using Puppeteer via
generateImage() - Commits the image file with
commitFile() - Posts preview comment (unless disabled)
- Generates HTML template with
- find-file.ts: Discovers markdown files in PR, filters by patterns, extracts frontmatter
- generate-image.ts: Uses Puppeteer with Chrome to screenshot HTML into base64 image
- file-filter.ts: Applies glob patterns to ignore specific files (default:
/README.md) - repo-props.ts: Merges GitHub Action inputs with defaults
- github-api.ts: Octokit client for GitHub API operations
- Input: Markdown files with
ogImagefrontmatter → File discovery & filtering → HTML generation → Image rendering → Git commit & comment
- Runs in Docker container with Chrome executable at
/usr/bin/google-chrome-stable - Uses
action.ymlto define GitHub Action interface
src/: TypeScript source code__tests__/: Test files for core functionalitydist/: Built outputdemo/: Example generated imagesaction.yml: GitHub Action configurationDockerfile: Container setup for action runtime
- Repository settings via GitHub Action inputs (path, colors, fonts, etc.)
- Per-file settings via frontmatter
ogImageobject - File filtering via
ignorePatternsglob patterns