INNER CODE UNIT · TypeScript
getOctokitClient
EndBug/add-and-commit · src/util.ts:35
function getOctokitClient() {
const token = getInput('github_token');
if (!token) {
throw new Error('github_token is required');
}
return getOctokit(token);
}
export async function getUserInfo(username?: string) {
if (!username) return undefined;
const octokit = getOctokitClient();
const res = await octokit.rest.users.getByUsername({username});
core.debug(
`Fetched github actor from the API: ${JSON.stringify(res?.data, null, 2)}`,
);