Skip to content

Instantly share code, notes, and snippets.

@tetsuharuohzeki
Created March 6, 2019 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tetsuharuohzeki/3b8c445f0958e59ee95e81138d87c5fc to your computer and use it in GitHub Desktop.
Save tetsuharuohzeki/3b8c445f0958e59ee95e81138d87c5fc to your computer and use it in GitHub Desktop.
Setup GitHub labels
'use strict';
const Octokit = require('@octokit/rest')
const clientWithAuth = new Octokit({
auth: 'token <blahblahblah>'
});
class LabelDef {
constructor(name, color, description) {
this.name = name;
this.color = color;
this.description = description ;
}
}
const titleList = [
new LabelDef('A-uncategorized', 'd7e102'),
new LabelDef('A-ops', 'd7e102'),
new LabelDef('A-ops/CI', 'd7e102'),
new LabelDef('A-repository', 'd7e102', 'AREA: nearly equals to governance'),
new LabelDef('A-dependencies', 'd7e102'),
new LabelDef('A-documentation', 'd7e102'),
new LabelDef('A-rule', 'd7e102', 'AREA: changes related to rules'),
new LabelDef('B-RFC', '5319e7', 'CATEGORIZATION TAGS: A request for comments on a proposal and approved'),
new LabelDef('B-investigation', '5319e7'),
new LabelDef('B-umbrella/meta', '5319e7', 'CATEGORIZATION TAGS: This issue tracks the status of multiple, related pieces of work'),
new LabelDef('C-wontfix', '02d7e1', 'CONDITION: The problem described will not be fixed'),
new LabelDef('C-achieved-consensus', '02d7e1', 'CONDITION: We reached a consensus'),
new LabelDef('C-clarifying', '02d7e1', 'CONDITION: More information is necessary'),
new LabelDef('C-disabled', '02d7e1', 'CONDITION: The issue describes an intermittent failure in a test, which has been temporarily disable'),
new LabelDef('C-duplicate', '02d7e1'),
new LabelDef('C-upstream', '02d7e1', 'CONDITION: The issue needs to be resolved in the upstream side that this repository depends upon'),
new LabelDef('C-works-for-me', '02d7e1', 'CONDITION: Needs steps to reproduce'),
new LabelDef('E-good first issue', '0e8a16', 'EFFORT: Straightforward. Recommended for a new comer.'),
new LabelDef('E-hard', '0e8a16', 'EFFORT: Very difficult. Do not attempt without significant relevant experience and motivation.'),
new LabelDef('E-less-easy', '0e8a16', 'EFFORT: Variable effort required; may require a mentor. Recommended solution is clearly described in'),
new LabelDef('I-bug', '84b6eb'),
new LabelDef('I-uncategorized', '84b6eb'),
new LabelDef('I-dependency-gardening', '84b6eb', 'IMPACT: gardening dependencies and libraries'),
new LabelDef('I-improve', '84b6eb'),
new LabelDef('I-refactor', '84b6eb'),
new LabelDef('I-cleanup', '84b6eb'),
new LabelDef('I-perf', '84b6eb'),
new LabelDef('I-question', '84b6eb'),
new LabelDef('I-security', '84b6eb'),
new LabelDef('I-breaking-change', 'e11d21'),
new LabelDef('I-papercut', '84b6eb', 'IMPACT: Small but painful'),
new LabelDef('L-JavaScript', 'bfd4f2'),
new LabelDef('L-TypeScript', 'bfd4f2'),
new LabelDef('P1', 'fef2c0', 'Priority 1: Required for MVP (Minimum Viable Product)'),
new LabelDef('P2', 'fef2c0', 'Priority 2: Required for post-MVP'),
new LabelDef('P3', 'fef2c0', 'Priority: 3: nice to fix'),
new LabelDef('S-awaiting-review', 'd4c5f9'),
new LabelDef('S-awaiting-merge', 'd4c5f9'),
new LabelDef('S-awaiting-answer', 'd4c5f9'),
new LabelDef('S-blocked-on-external', 'd4c5f9'),
new LabelDef('S-needs-rebase', 'd4c5f9'),
new LabelDef('S-needs-code-change', 'd4c5f9'),
new LabelDef('S-work-in-progress', 'd4c5f9'),
new LabelDef('S-tests-failed', 'd4c5f9'),
new LabelDef('S-needs-squash', 'd4c5f9'),
new LabelDef('S-needs-new-owner', 'd4c5f9'),
new LabelDef('S-needs-docs-change', 'd4c5f9'),
new LabelDef('S-needs-decision', 'd4c5f9'),
new LabelDef('S-needs-tests', 'd4c5f9'),
];
(async () => {
for (const item of titleList) {
const owner = 'cats-oss';
const repo = 'eslint-config-abema';
const { color, name, description } = item;
const args = { owner, repo, /* current_name: name ,*/ name, color, description };
console.log(args);
// await clientWithAuth.issues.deleteLabel({owner, repo, name})
await clientWithAuth.issues.createLabel(args);
}
})().catch(console.error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment