Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

KnisterPeter/octogit

Repository files navigation

octogit

A wrapper library to interact with github projects.

It uses octokit and git under the hood.

Why?

octokit is a very nice, up to date and generated wrapper for the GitHub API but there are a few things missing.

  • There are no rebases for pull requests
  • Large parts of the GitHub API feels (are?) eventual consistent while git is not

To mitigate these, we do use git in combination with the Github APIs to work around. That means we try to use as much as possible with low-level git APIs (through the awesome simple-git library) and only handle higher or easier integration with the GitHub APIs.

Usage

import { Octogit } from "octogit";
import { promises as fsp } from "fs";
import { join } from "path";

const octogit = await Octogit.create({
  token: "e.g. github personal access token",
  owner: "octocat",
  repo: "hello-world",
});

const branch = octogit.getBranch("some-branch");
await branch.create();
await fsp.writeFile(join(octogit.directory, 'some-file.txt'), 'some content'));
await branch.addAndCommit("Commit message...");
await branch.push();

const pr = await branch.createPullRequest({
  base: octogit.getBranch("main"),
  title: `Pull Request Title...`,
});

await pr.merge.merge();

About

This is a small helper/wrapper for octokit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published