• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
flymaster

flymaster

deploy

Public
Like
deploy
Home
Code
2
README.md
H
main.ts
Branches
1
Pull requests
Remixes
History
Environment variables
2
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
…
Viewing readonly version of main branch: v22
View latest version
README.md

Universal Git Repository Webhook

This webhook automatically clones any git repository and updates the "lifehub" val with its contents whenever accessed via HTTP. Uses isomorphic-git for pure JavaScript git operations.

Setup

  1. Set the environment variable repo to any Git repository URL (HTTPS format):

    repo=https://github.com/username/repository-name
    repo=https://gitlab.com/username/repository-name  
    repo=https://git.sr.ht/~username/repository-name
    repo=https://your-git-server.com/username/repository-name
    
  2. The webhook is automatically triggered when this val receives an HTTP request.

Supported Git Hosting Services

  • ✅ GitHub - Full support
  • ✅ GitLab - Full support
  • ✅ SourceHut - Full support
  • ✅ Bitbucket - Full support
  • ✅ Self-hosted Git - Full support
  • ✅ Any Git repository accessible via HTTPS - Full support

How it works

  1. Repository Cloning: Uses isomorphic-git to clone the repository in-memory
  2. File Processing: Processes all text files from the repository
  3. Content Filtering: Automatically skips binary files and .git directory
  4. Lifehub Generation: Creates a comprehensive val containing all repository content

API Response

Success Response

{ "success": true, "message": "Successfully updated lifehub val with X files from repository-name", "files": ["file1.js", "file2.md", ...], "repository": "https://github.com/username/repository-name.git" }

Error Response

{ "error": "Failed to clone repository", "details": "Detailed error message", "repository": "https://github.com/username/repository-name.git" }

Lifehub Val Features

The generated lifehub val includes:

  • File Access: Get specific files via ?file=filename query parameter
  • File Listing: GET request without parameters returns all files and metadata
  • Helper Functions:
    • getFile(filename): Get content of a specific file
    • listFiles(): Get array of all file names
    • searchFiles(pattern): Search files by regex pattern
    • getFilesByExtension(ext): Get files by extension

Usage Examples

Trigger the webhook

# Regular webhook (uses 'repo' environment variable) curl https://your-val-url.web.val.run # Test with sample repository curl https://your-val-url.web.val.run/test

Access lifehub content

# Get file list and metadata curl https://lifehub-val-url.web.val.run # Get specific file curl https://lifehub-val-url.web.val.run?file=README_md

Use lifehub programmatically

import { getFile, listFiles, searchFiles, getFilesByExtension } from "./lifehub"; // Get a specific file const readme = getFile("README.md"); // List all files const allFiles = listFiles(); // Search for files const jsFiles = searchFiles("\\.js$"); // Get files by extension const markdownFiles = getFilesByExtension("md");

Features

  • Universal Git Support: Works with any Git repository accessible via HTTPS
  • In-Memory Processing: No local file system required
  • Binary File Filtering: Automatically skips binary files
  • Text File Processing: Processes all text-based files
  • Comprehensive API: Rich set of helper functions for accessing content
  • Error Handling: Graceful handling of clone failures and processing errors

Limitations

  • Only processes text files (binary files are automatically skipped)
  • Clones only the default branch with depth=1 for performance
  • File names are sanitized for Val Town compatibility
  • Repository must be publicly accessible or use authentication (see below)

Authentication

For private repositories, you can add authentication by modifying the clone call:

await git.clone({ fs: fsImpl, http, dir: '/', url: repoUrl, singleBranch: true, depth: 1, headers: { 'Authorization': `token ${Deno.env.get('GIT_TOKEN')}` } });

Environment Variables

  • repo: Git repository URL in HTTPS format (required)
  • GIT_TOKEN: Authentication token for private repositories (optional)

Security Notes

  • Generated vals are set to "unlisted" privacy by default
  • No authentication required for webhook trigger (add if needed)
  • Repository must be accessible via the provided URL
  • Binary files are automatically filtered out for security

Performance

  • Uses shallow clone (depth=1) for faster processing
  • In-memory file system for efficient processing
  • Processes only text files to reduce memory usage
  • Suitable for repositories up to several hundred files
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.