github-label-copier
is a simple tool to copy labels from one repository, either your own or someone else's, to your own repository.
npm install github-label-copier
const { createCopier } = require('github-label-copier');
// or
import { createCopier } from 'github-label-copier';
const copier = createCopier(YOUR_GITHUB_TOKEN);
copier.copyLabels({
from: 'https://github.com/{OWNER}/{REPO}', // Source repository
to: 'https://github.com/{OWNER}/{REPO}', // Destination repository
});
const labels = await copier.getLabels({
url: 'https://github.com/freeCodeCamp/freeCodeCamp',
});
console.log(labels);
copier.saveLabels({
url: 'https://github.com/Owner/Repo',
format: 'json', // 'json' | 'yaml', Default: 'json'
});
# labels.yaml
- name: 'docs :books:'
color: FFCACC
description: docs label
- name: 'feat :sparkles:'
color: CBFFA9
description: add new feature
- name: 'test :white_check_mark:'
color: DBC4F0
description: add test
const dotenv = require('dotenv');
dotenv.config();
const { createCopier } = require('github-label-copier');
const token = process.env.GITHUB_TOKEN;
const copier = createCopier(token);
async function main() {
copier.pushLabels({
filename: 'labels.yaml',
url: 'https://github.com/leemhoon00/github-label-copier',
});
}
main();