"typescript" "manage and configure a list of Github repositories and their settings including branch protection rules"
$ upg
__ ______ ____ _ UPG CLI
/ / / / __ \/ __ `/ Public Beta
/ /_/ / /_/ / /_/ /
\__,_/ .___/\__, / πΊπΈ Built by GPT Labs
/_/ /____/ We put Leetcode out of business!
(c) 2022 MIT License
Logged in.
β Checking subscription...
β What language is this program written in? β¦ typescript
β What will this program do? β¦ manage and configure a list of Github repositories and their settings including branch protection rules
var github = require('github-api');
// basic auth
var gh = new github({
username: 'yourusername',
password: 'yourpassword'
});
// or oauth
var gh = new github({
token: 'yourtoken'
});
// or oauth key/secret
var gh = new github({
key: 'yourkey',
secret: 'yoursecret'
});
// list repositories
gh.getRepos().list(function(err, repos) {
console.log(repos);
});
// get a specific repository
var repo = gh.getRepo('username', 'reponame');
// list branches
repo.listBranches(function(err, branches) {
console.log(branches);
});
// get a specific branch
repo.getBranch('master', function(err, branch) {
console.log(branch);
});
// create a new branch
repo.createBranch('newBranch', 'master', function(err, branch) {
console.log(branch);
});
// delete a branch
repo.deleteBranch('newBranch', function(err) {
console.log(err);
});
// protect a branch
repo.protectBranch('master', function(err) {
console.log(err);
});
// unprotect a branch
repo.unprotectBranch('master', function(err) {
console.log(err);
});
fail