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: v42View latest version
This webhook works with ANY git repository by using RSS feeds and tarballs. It fetches the latest commit from the repository's RSS feed, downloads the corresponding tarball, and deploys all non-dot files to the lifehub val.
- RSS Feed: Fetches the repository's RSS feed (
{repo_url}.rss) - Latest Commit: Gets the most recent commit from the RSS feed
- Tarball Download: Downloads the tarball from
{commit_link}.tar.gz - File Extraction: Extracts all non-dot files from the tarball
- Lifehub Deployment: Creates/updates the lifehub val with all repository content
-
Set the environment variable
repoto any Git repository URL:repo=https://github.com/username/repository-name repo=https://gitlab.com/username/repository-name repo=https://git.sr.ht/~username/repository-name repo=https://codeberg.org/username/repository-name repo=https://your-git-server.com/username/repository-name -
The webhook is automatically triggered when this val receives an HTTP request.
- ✅ GitHub - Full support
- ✅ GitLab - Full support
- ✅ SourceHut - Full support
- ✅ Codeberg - Full support
- ✅ Bitbucket - Full support
- ✅ Gitea/Forgejo - Full support
- ✅ Self-hosted Git - Full support (if RSS feeds are enabled)
- ✅ Any Git repository with RSS feeds - Full support
This approach works with virtually any Git hosting service that provides RSS feeds for commits.
{ "success": true, "message": "Successfully deployed X files to lifehub val", "files": ["file1.js", "file2.md", ...], "repository": "https://github.com/username/repository-name", "commit": "Latest commit message", "commitLink": "https://github.com/username/repository-name/commit/abc123" }
{ "error": "Failed to process repository", "details": "Detailed error message", "repository": "https://github.com/username/repository-name" }
The generated lifehub val includes:
- File Access: Get specific files via
?file=filenamequery parameter - File Listing: GET request without parameters returns all files and metadata
- Repository Metadata: Commit info, timestamps, and repository details
- Helper Functions:
getFile(filename): Get content of a specific filelistFiles(): Get array of all file namesgetMetadata(): Get repository and commit metadatasearchFiles(pattern): Search files by regex patterngetFilesByExtension(ext): Get files by extension
# 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
# 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
import { getFile, listFiles, getMetadata, searchFiles } from "./lifehub";
// Get a specific file
const readme = getFile("README.md");
// List all files
const allFiles = listFiles();
// Get repository metadata
const meta = getMetadata();
console.log(`Last commit: ${meta.lastCommit}`);
// Search for files
const jsFiles = searchFiles("\\.js$");
- Universal Compatibility: Works with any Git host that provides RSS feeds
- Latest Commit Tracking: Always gets the most recent changes
- Complete Repository: Downloads entire repository content via tarball
- Non-Dot File Filtering: Automatically excludes hidden files and .git directory
- Binary File Filtering: Automatically skips binary files
- Rich Metadata: Includes commit information and timestamps
- Comprehensive API: Full set of helper functions for accessing content
- Included: All text files that don't start with a dot
- Excluded:
- Dot files (
.gitignore,.env, etc.) .gitdirectory and contents- Binary files (detected by null bytes)
- Directory entries
- Dot files (
- RSS Dependency: Requires the Git hosting service to provide RSS feeds
- Public Repositories: Works best with public repositories (private repos may need authentication)
- Tarball Format: Relies on standard
.tar.gztarball availability - Text Files Only: Binary files are automatically filtered out
- File Names: Sanitized for Val Town compatibility
The webhook provides detailed error messages for common issues:
- RSS feed not found or inaccessible
- No commits found in RSS feed
- Tarball download failures
- Extraction errors
- Invalid repository URLs
repo: Git repository URL in HTTPS format (required)
- Generated vals are set to "unlisted" privacy by default
- No authentication required for webhook trigger
- Repository must be publicly accessible or provide public RSS feeds
- Binary files are automatically filtered out for security
- Only non-dot files are included to avoid sensitive configuration files
- Efficient: Downloads only the latest commit via tarball
- Complete: Gets entire repository content in one request
- Fast: No recursive API calls needed
- Memory Efficient: Processes files individually during extraction
- Scalable: Works with repositories of any size (within memory limits)