GitHub
This package aims to ease the process of interacting with GitHub.
Interface:
export interface IGitHub {
getComments(owner: string, repository: string, issueNumber?: string): Promise<IGitHubComment[]>;
deleteComment(owner: string, repository: string, commentId: string): Promise<any>;
postComment(owner: string, repository: string, issueNumber: string, body: string): Promise<IGitHubComment>;
}
Installation:
npm install --save @studyportals/github
Example:
TypeScript
import {GitHub} from "@studyportals/github";
const GH = new GitHub(process.env.GITHUB_TOKEN);
return GH.postComment("studyportals", "github", "1", "Comment description")
.then((comment) => { });
Node
const github = require("@studyportals/github");
const GH = new github.GitHub(process.env.GITHUB_TOKEN);
return GH.postComment("studyportals", "github", "1", "Comment description")
.then((comment) => { });
Development
This package can be compiled and tested locally.
-
npm install
- Install the dependencies -
npm test
- Runs the test suite (will lint and compile first) -
npm compile
- Compiles the entire project -
npm run setup-hooks
- Install Git hooks. This will add a pre-commit hook to ensure code quality. -
npm run watch
- Watch the project and compile on the fly.
Please have a look at package.json scripts section.
Publishing NPM package
This package is automatically published by TravisCI for every commit on master.
# Draft a new version
# @see: https://docs.npmjs.com/cli/version
# @see: https://semver.org/
npm version [<newversion> | major | minor | patch | prerelease ]
# Push the commit and tags
git push --follow-tags