FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
nbbaier
nbbaiervalToGH
Public
Like
6
valToGH
Home
Code
2
README.md
S
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
Sign up now
Code
/
Code
/
Search
README.md

valToGH

A utility function for programmatically updating a GitHub repository with code retrieved from a Val.

NOTE: This function currently does not change the contents of a file if it is already present. I will however be adding that functionality.

Usage

Create val
import { valToGH } from 'https://esm.town/v/nbbaier/valToGH'; const repo = "yourGitHubUser/yourRepo"; const val = "valUser/valName"; // or vals = ["valUser/valName1","valUser/valName2", ...] const ghToken = Deno.env.get("yourGitHubToken"); const result = await valToGH(repo, val, ghToken); console.log(result);

Parameters

  • repo: The GitHub repository in the format {user}/{repo}.
  • val: A single repository in the format {user}/{val}.
  • ghToken: Your GitHub token for authentication (must have write permission to the target repo)

Options

  • branch: Optional target branch. Default is main.
  • prefix: Optional directory path prefix for each file.
  • message: Optional commit message. Default is the current date and time in the format yyyy-MM-dd T HH:mm:ss UTC.
  • ts: Optional flag to use a .ts extension for the committed file instead of the default .tsx.
Code
README.md
S
main.tsx
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.