MCPcopy Create free account
hub / github.com/RealDevSquad/website-backend / fetchIssuesById

Function fetchIssuesById

services/githubService.js:269–289  ·  view source on GitHub ↗
(repositoryName, issueId)

Source from the content-addressed store, hash-verified

267 * @returns {Object | null} - Object containing Issue details or null if no issue is found.
268 */
269const fetchIssuesById = async (repositoryName, issueId) => {
270 try {
271 const baseURL = config.get("githubApi.baseUrl");
272 const org = config.get("githubApi.org");
273 const url = `${baseURL}/repos/${org}/${repositoryName}/issues/${issueId}`;
274 const headers = {
275 Accept: "application/vnd.github+json",
276 Authorization: `Bearer ${config.get("githubAccessToken")}`,
277 org: org,
278 };
279 const res = await fetch(url, { headers });
280 if (!res.ok) {
281 logger.error(`GitHub API request failed. Status: ${res.status}, URL: ${url}`);
282 return null;
283 }
284 return await res.json();
285 } catch (err) {
286 logger.error(`Error while fetching issues: ${err}`);
287 throw err;
288 }
289};
290
291/**
292 * Fetches the last merged PR by a user

Callers 1

Calls 2

fetchFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected