slack-prgithub-pr-inherit-labels.ts10 matches
108console.log("๐ Current PR labels:", currentLabels);
109
110// Fetch labels from all linked issues
111const repo = payload.repository.full_name;
112let allIssueLabels: string[] = [];
113
114for (const issueNumber of issueNumbers) {
115console.log(`๐ Fetching labels for issue #${issueNumber}`);
116try {
117const issue = await fetchIssue(repo, issueNumber);
118const issueLabels = issue.labels.map(label => label.name);
119console.log(`๐ Labels for issue #${issueNumber}:`, issueLabels);
126}
127} catch (error) {
128console.error(`โ Error fetching issue #${issueNumber}:`, error);
129// Continue with other issues even if one fails
130}
190}
191192// Fetch issue details
193async function fetchIssue(repo: string, issueNumber: number): Promise<GitHubIssue> {
194const token = Deno.env.get("GITHUB_TOKEN");
195
199
200const url = `https://api.github.com/repos/${repo}/issues/${issueNumber}`;
201console.log("๐ Fetching issue from:", url);
202
203const response = await fetch(url, {
204headers: {
205"Authorization": `token ${token}`,
221console.error("โ GitHub API error text:", errorText);
222}
223throw new Error(`Failed to fetch issue: ${errorMessage}`);
224}
225
240console.log("๐ Sending labels update request to:", url);
241
242const response = await fetch(url, {
243method: "POST",
244headers: {
712. This Val filters for approval events
723. When an approval is detected, it:
73- Fetches detailed PR information
74- Checks if the PR is mergeable and all required checks are passing
75- Sends a formatted message to Slack
158console.log("๐ Sending assignee request to:", url);
159
160const response = await fetch(url, {
161method: "POST",
162headers: {
165console.log("๐ Sending title update request to:", url);
166
167const response = await fetch(url, {
168method: "PATCH",
169headers: {
slack-prgithub-slack-pr-approvals.ts25 matches
204
205// Get detailed PR info including checks status
206console.log("๐ Fetching detailed PR info...");
207try {
208const prDetails = await fetchPRDetails(repository.full_name, pull_request.number);
209console.log("๐ PR details fetched successfully");
210console.log("๐ PR mergeable status:", prDetails.mergeable);
211console.log("๐ PR mergeable state:", prDetails.mergeable_state);
236return new Response("Notification sent to Slack", { status: 200 });
237} catch (prError) {
238console.error("โ Error fetching PR details or sending notification:", prError);
239console.error("โ Error stack:", prError.stack);
240return new Response(`Error: ${prError.message}\nStack: ${prError.stack}`, { status: 500 });
360}
361362// Fetch detailed PR information including checks status
363async function fetchPRDetails(repo: string, prNumber: number) {
364console.log(`๐ Starting fetchPRDetails for PR #${prNumber} in ${repo}`);
365
366const token = Deno.env.get("GITHUB_TOKEN");
373// Get PR details
374const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}`;
375console.log("๐ Fetching from GitHub API URL:", url);
376
377let response;
378try {
379response = await fetch(url, {
380headers: {
381"Authorization": `token ${token}`,
388console.log("๐ Response status text:", response.statusText);
389console.log("๐ Response headers:", JSON.stringify(Object.fromEntries([...response.headers])));
390} catch (fetchError) {
391console.error("โ Network error fetching PR details:", fetchError);
392console.error("โ Error stack:", fetchError.stack);
393throw new Error(`Network error fetching PR details: ${fetchError.message}`);
394}
395
413}
414
415throw new Error(`Failed to fetch PR details: ${response.status} ${response.statusText}`);
416}
417
461console.log("๐ Verifying PR is still mergeable before attempting merge");
462try {
463const prDetails = await fetchPRDetails(repo, prNumber);
464console.log("๐ PR current mergeable status:", prDetails.mergeable);
465console.log("๐ PR current mergeable state:", prDetails.mergeable_state);
504let response;
505try {
506response = await fetch(url, {
507method: "PUT",
508headers: {
518console.log("๐ Response status text:", response.statusText);
519console.log("๐ Response headers:", JSON.stringify(Object.fromEntries([...response.headers])));
520} catch (fetchError) {
521console.error("โ Network error during merge request:", fetchError);
522console.error("โ Error stack:", fetchError.stack);
523return {
524success: false,
525message: `Network error during merge: ${fetchError.message}`
526};
527}
676let response;
677try {
678response = await fetch(slackWebhookUrl, {
679method: "POST",
680headers: {
687console.log("๐ Response status text:", response.statusText);
688console.log("๐ Response headers:", JSON.stringify(Object.fromEntries([...response.headers])));
689} catch (fetchError) {
690console.error("โ Network error sending to Slack:", fetchError);
691console.error("โ Error stack:", fetchError.stack);
692throw new Error(`Network error sending to Slack: ${fetchError.message}`);
693}
694
TownieuseAuth.tsx1 match
15// replace all this with oauth when it's ready
16try {
17const res = await fetch("/api/user", {
18headers: {
19"Authorization": "Bearer " + valTownAPIKey,
helloooooooindex.ts1 match
129130// This is the entry point for HTTP vals
131export default app.fetch;
helloooooooindex.html2 matches
116posts = window.INITIAL_DATA.posts;
117} else {
118const response = await fetch('/api/posts');
119posts = await response.json();
120}
156
157try {
158const response = await fetch(`/api/posts/${params.slug}`);
159
160if (!response.ok) {
sqliteExplorerApp2main.tsx4 matches
1/** @jsxImportSource npm:hono/jsx **/
23import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { iframeHandler } from "https://esm.town/v/nbbaier/iframeHandler";
5import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
16import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
17import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
18import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
19import { Hono } from "npm:hono";
20import type { FC } from "npm:hono/jsx";
175});
176177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));