13 const webhookSecret = process.env.githubWebhookApproveDependencyPRs;
14 // the token to make github requests (needs `repo` permissions)
15 const githubApiToken = process.env.githubApproveDependencyPRsToken;
16 const valHttpUrl = thisValUrl();
17 const approvalMessage = `Automatically approved by ${valHttpUrl}`;
48 const { Octokit } = await import("npm:@octokit/core");
49 const octokit = new Octokit({
50 auth: githubApiToken,
51 });
52 const { repository, organization } = payload;
66 const checks = (await octokit.request(pr.statuses_url, {
67 headers: {
68 "X-GitHub-Api-Version": "2022-11-28",
69 },
70 })).data;
80 branch: pull_request.base.ref,
81 headers: {
82 "X-GitHub-Api-Version": "2022-11-28",
83 },
84 },
102 event: "APPROVE",
103 headers: {
104 "X-GitHub-Api-Version": "2022-11-28",
105 },
106 },
131};
132// Forked from @vtdocs.githubWebhookWithVerify
133// switched from express to WebApi using https://www.val.town/v/neverstew.githubWebhookApproveDependencyPRs
1export function myApi(name) {
2 return "hi " + name;
3}
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let valTownApiExampleUser = (async () => {
4 const handle = "tmcw";
5 const response = await fetch(`https://api.val.town/v1/alias/${handle}`);
6 const json = await response.json();
7 return json;
3// Cities named Brooklyn
4export let githubStarred = fetchJSON(
5 "https://api.github.com/users/stevekrouse/starred",
6);
5export async function openAqNowcastAQI({ location_id }) {
6 const { results } = await fetchJSON(
7 "https://api.openaq.org/v2/measurements?" +
8 new URLSearchParams({
9 limit: "100",
7 const supportedLanguages = ["JavaScript", "TypeScript"];
8 let imported = [];
9 const headers = { "X-GitHub-Api-Version": "2022-11-28" };
10 const { Octokit } = await import("npm:@octokit/core");
11 const octokit = new Octokit({ auth: githubToken });
1export function myApi(name) {
2 return "hi " + name;
3}
1export function myApi(name) {
2 return "hi " + name;
3}
3// returns NASA's Astronomy Picture of the Day (APOD)
4export const nasaAPOD = fetchJSON(
5 "api.nasa.gov/planetary/apod?api_key=DEMO_KEY",
6);
1export function myApi(name) {
2 return "hi " + name;
3}