untitled-2604new-file-9513.tsx3 matches
77const url = 'https://api.openai.com/v1/chat/completions';
78
79const response = await fetch(url, {
80method: 'POST',
81headers: {
112const url = 'https://api.anthropic.com/v1/messages';
113
114const response = await fetch(url, {
115method: 'POST',
116headers: {
374
375// Enviar solicitud
376const response = await fetch(endpointUrl, {
377method: 'POST',
378headers: {
morningmailmain.tsx1 match
1011async function wikitext(): string {
12const randomArticle = await fetch(
13"https://en.wikipedia.org/w/api.php?action=query&format=json&prop=extracts&exintro&explaintext&redirects=1&generator=random&formatversion=2&grnnamespace=0&grnlimit=3",
14);
81async function getDiscussionPosts(discussionId: string): Promise<PostT[]> {
82// Used to get the list of post id's for the discussion.
83const discussionRes = await fetch(`${server}/api/discussions/${discussionId}`);
84const discussionResJson = await discussionRes.json();
859394await Promise.all(chunks.map(async (c: string[]) => {
95const postRes = await fetch(`${server}/api/posts?filter[id]=${c.join(",")}`);
96const postJson = await postRes.json();
97
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
Towniesend-message.ts3 matches
79}
8081// If there are selected files, fetch their content and add them to the messages
82if (selectedFiles && selectedFiles.length > 0) {
83const vt = new ValTown({ bearerToken });
99fileContents += `## File: ${filePath}\n\`\`\`\n${fileWithLinesNumbers(content)}\n\`\`\`\n\n`;
100} catch (error) {
101console.error(`Error fetching file ${filePath}:`, error);
102fileContents += `## File: ${filePath}\nError: Could not fetch file content\n\n`;
103}
104}
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,