1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { githubFileCache } from "https://esm.town/v/stevekrouse/githubFileCache";
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
export let githubFileChanged = async (owner, repo, file) => {
let handle = `${owner}/${repo}/${file}`
let current = await fetchJSON(`https://api.github.com/repos/${owner}/${repo}/contents/${file}`)
let previous = githubFileCache[handle]
if (previous?.content && current?.content && previous?.content !== current?.content) {
console.email(
current.html_url,
`${handle} changed`
)
}
githubFileCache[handle] = current
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023