• 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: v17
View latest version
README.md

Git Repository Webhook

This webhook automatically clones a git repository and updates the "lifehub" val with its contents whenever accessed via HTTP.

Setup

  1. Set the environment variable repo to your GitHub or GitLab repository URL (HTTPS format):

    repo=https://github.com/username/repository-name
    # or
    repo=https://gitlab.com/username/repository-name
    
  2. The webhook is automatically triggered when this val receives an HTTP request.

Supported Git Hosting Services

  • ✅ GitHub - Full API support
  • ✅ GitLab - Full API support
  • ❌ SourceHut - Not supported (no public API)

For SourceHut repositories, please mirror them to GitHub or GitLab to use this webhook.

How it works

  1. Repository Parsing: Extracts owner and repository name from the GitHub/GitLab URL
  2. Content Fetching: Uses the hosting service's API to recursively fetch all files from the repository
  3. File Processing: Downloads and processes each file, converting them to Val Town format
  4. Lifehub Update: Generates code for the "lifehub" val containing all repository content

API Response

Success Response

{ "success": true, "message": "Successfully updated lifehub val with X files from owner/repo", "files": ["file1.js", "file2.md", ...] }

Error Response

{ "error": "Error description", "details": "Detailed error message" }

Lifehub Val Features

The generated lifehub val will include:

  • 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

Usage Examples

Trigger the webhook

curl https://your-val-url.web.val.run

Access lifehub content

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

Limitations

  • Only processes text files (binary files are skipped)
  • File names are sanitized for Val Town compatibility
  • Large repositories may take time to process
  • Currently logs the generated code (actual Val Town API integration needed)

Environment Variables Required

  • repo: GitHub or GitLab repository URL in HTTPS format

Security Notes

  • Generated vals are set to "unlisted" privacy by default
  • No authentication required for webhook trigger (add if needed)
  • Repository must be public or accessible via the provided URL

Troubleshooting

SourceHut Repository Error

If you see an error about SourceHut repositories not being supported:

  1. Create a mirror of your SourceHut repository on GitHub or GitLab
  2. Update the repo environment variable to point to the GitHub/GitLab URL
  3. Trigger the webhook again

API Rate Limits

  • GitHub: 60 requests per hour for unauthenticated requests
  • GitLab: 2000 requests per hour for unauthenticated requests

For higher limits, you can add authentication tokens to the API calls.

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.