Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

ofKrown/github-label-sync-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

github-label-sync-api

Installation

$ yarn add github-label-sync-api

API token

You will need a GitHub API token. You can create one here -> https://github.com/settings/tokens. Make sure to check 'repo - Full control of private repositories'

async - await

github-label-sync-api uses async-await syntax. You will need to run your script with the --harmony-async-await flag.

e.g.:

$ node --harmony-async-await index.js

Usage

const api = require('github-label-sync-api');

const token = 'dummytoken';
const repositoryName = 'bmatz/github-label-sync-api';

// get affiliated repositories
const repositories = await api.getAffiliated(token);

// get specific repository (public or one of your affiliated repositories)
const repository = await api.getRepository(token, repositoryName);

// get a repositories issue labels
const labels = await api.getLabels(token, repositoryName);

// create a single label
await api.createLabel(token, repositoryName, {
  name: 'TestLabel',
  color: 'ff0011'
});

// create multiple labels
await api.createLabels(token, repositoryName, [{
  name: 'TestLabel',
  color: 'ff0011'
}, {
  name: 'TestLabel2',
  color: 'ff1111'
}]);


// update a single label
await api.updateLabel(token, repositoryName, {
  name: 'TestLabel',
  color: 'ff0022'
});

// update multiple labels
await api.updateLabels(token, repositoryName, [{
  name: 'TestLabel',
  color: 'ff0022'
}, {
  name: 'TestLabel2',
  color: 'ff1122'
}]);


// delete a single label
await api.deleteLabel(token, repositoryName, 'TestLabel');

// delete multiple labels
await api.deleteLabels(token, repositoryName, ['TestLabel', 'TestLabel2']);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published