deploy
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.
Viewing readonly version of main branch: v6View latest version
This webhook automatically clones a git repository and updates the "lifehub" val with its contents whenever accessed via HTTP.
-
Set the environment variable
repoto your GitHub repository URL (HTTPS format):repo=https://github.com/username/repository-name -
The webhook is automatically triggered when this val receives an HTTP request.
- Repository Parsing: Extracts owner and repository name from the GitHub URL
- Content Fetching: Uses GitHub's API to recursively fetch all files from the repository
- File Processing: Downloads and processes each file, converting them to Val Town format
- Lifehub Update: Generates code for the "lifehub" val containing all repository content
{ "success": true, "message": "Successfully updated lifehub val with X files from owner/repo", "files": ["file1.js", "file2.md", ...] }
{ "error": "Error description", "details": "Detailed error message" }
The generated lifehub val will include:
- File Access: Get specific files via
?file=filenamequery parameter - File Listing: GET request without parameters returns all files and metadata
- Helper Functions:
getFile(filename): Get content of a specific filelistFiles(): Get array of all file names
curl https://your-val-url.web.val.run
# 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
- 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)
repo: GitHub repository URL in HTTPS format
- 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