@tomsd/github-repo

It's a utility for GitHub.

installation

npm install @tomsd/github-repo

usage

import class

import { GitHub } froom "@tomsd/github-repo";

create an instance

const github = new GitHub(GITHUB_TOKEN);

get repo instance

const repo = github.organization(OWNER).repo(REPO);

fetching data

// call ensureData() of each instance
await repo.ensureData();
await issue.ensureData();
await pull.ensureData();

get repo instance

const repo = github.organization(OWNER).repo(REPO);

get branches

await repo getBranches();

get tags

await repo getTags();

get branch sha

await repo.getBranchSha("main");

get branch tree

await repo getBranchTree("main");

get file content

await repo.getFileContent("path/to/file");

create a tag

await repo.createTag("my-tag", "main");

list pull requests

await repo.listPulls({ base: "main" });

list issues

await repo.listIssues({ state: "all" });