type Github = {
token: string;
};
/**
* Get the weekly commit count
* Returns the total commit counts for the `owner` and total commit counts in `all`. `all` is everyone combined, including the `owner` in the last 52 weeks. If you'd like to get the commit counts for non-owners, you can subtract `owner` from `all`.
The array order is oldest week (index 0) to most recent week.
*/
export async function main(auth: Github, owner: string, repo: string) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/stats/participation`
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 367 days ago
type Github = {
token: string;
};
/**
* Get the weekly commit count
* Returns the total commit counts for the `owner` and total commit counts in `all`. `all` is everyone combined, including the `owner` in the last 52 weeks. If you'd like to get the commit counts for non-owners, you can subtract `owner` from `all`.
The array order is oldest week (index 0) to most recent week.
*/
export async function main(auth: Github, owner: string, repo: string) {
const url = new URL(
`https://api.github.com/repos/${owner}/${repo}/stats/participation`
);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 927 days ago