https://github.com/leemhoon00/github-label-copier
A simple tool to copy labels from one repository, either your own or someone else's, to your own repository.
https://github.com/leemhoon00/github-label-copier
copy github label
Last synced: 6 days ago
JSON representation
A simple tool to copy labels from one repository, either your own or someone else's, to your own repository.
- Host: GitHub
- URL: https://github.com/leemhoon00/github-label-copier
- Owner: leemhoon00
- License: mit
- Created: 2024-03-08T12:03:26.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-16T13:21:53.000Z (almost 2 years ago)
- Last Synced: 2025-09-21T11:35:43.105Z (4 months ago)
- Topics: copy, github, label
- Language: TypeScript
- Homepage: https://velog.io/@leemhoon00/%EA%B9%83%ED%97%88%EB%B8%8C-%EB%A0%88%EC%9D%B4%EB%B8%94-%EB%8F%84%EB%91%91%EC%9D%84-%EB%A7%8C%EB%93%A4%EC%96%B4-%EB%B3%B4%EC%95%98%EB%8B%A4
- Size: 85.9 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Github Label Copier
`github-label-copier` is a simple tool to copy labels from one repository, either your own or someone else's, to your own repository.
## Usage
### Installation
```bash
npm install github-label-copier
```
### Import
```javascript
const { createCopier } = require('github-label-copier');
// or
import { createCopier } from 'github-label-copier';
```
### Initialization
```javascript
const copier = createCopier(YOUR_GITHUB_TOKEN);
```
### Copy Labels
```javascript
copier.copyLabels({
from: 'https://github.com/{OWNER}/{REPO}', // Source repository
to: 'https://github.com/{OWNER}/{REPO}', // Destination repository
});
```
### Get Labels
```javascript
const labels = await copier.getLabels({
url: 'https://github.com/freeCodeCamp/freeCodeCamp',
});
console.log(labels);
```
### Save Labels
```javascript
copier.saveLabels({
url: 'https://github.com/Owner/Repo',
format: 'json', // 'json' | 'yaml', Default: 'json'
});
```
### Push Labels by Json or Yaml
```yaml
# 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
```
```javascript
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();
```
