MCPcopy Create free account
hub / github.com/appium/appium / makeGitHubRequest

Function makeGitHubRequest

scripts/github-contrib-stats.mjs:106–125  ·  view source on GitHub ↗

* Make request to GitHub API (authenticated or unauthenticated) * @param {string} endpoint - API endpoint * @param {string|null} token - GitHub token (optional) * @returns {Promise<{data: any, headers: any}>}

(endpoint, token)

Source from the content-addressed store, hash-verified

104 * @returns {Promise<{data: any, headers: any}>}
105 */
106async function makeGitHubRequest(endpoint, token) {
107 const url = `${GITHUB_API_BASE}${endpoint}`;
108 const headers = {
109 Accept: 'application/vnd.github.v3+json',
110 'User-Agent': 'appium-contrib-stats',
111 };
112
113 // Add authorization header only if token is provided
114 if (token) {
115 headers.Authorization = `token ${token}`;
116 }
117
118 const response = await axios({
119 method: 'GET',
120 url,
121 headers,
122 });
123
124 return {data: response.data, headers: response.headers};
125}
126
127/**
128 * Get merged pull requests from the Appium organization for the specified date range using GitHub search API

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected