Skip to content

Commit 5e6b910

Browse files
committed
feat: add maintenance label
1 parent 0c7bca7 commit 5e6b910

File tree

4 files changed

+85
-77
lines changed

4 files changed

+85
-77
lines changed

index.js

Lines changed: 50 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const IGNORE_REPOSITORIES = require("./lib/ignored-repositories");
66
const toLabelsList = require("./lib/to-labels-list");
77
const validateLabnels = require("./lib/validate-labels");
88
const setCard = require("./lib/set-card");
9+
const normalizeLabels = require("./lib/normalize-labels");
910
const Octokit = require("./lib/octokit");
1011

1112
run();
@@ -24,7 +25,7 @@ async function run() {
2425
type: "public",
2526
}
2627
)) {
27-
for (const repository of response.data.slice(3)) {
28+
for (const repository of response.data) {
2829
console.log("-".repeat(80));
2930

3031
if (repository.archived) {
@@ -37,59 +38,59 @@ async function run() {
3738
continue;
3839
}
3940

40-
console.log(`Loading issues for ${repository.name}`);
4141
const owner = repository.owner.login;
4242
const repo = repository.name;
4343

44-
console.log("loading issues");
45-
46-
// https://developer.github.com/v3/issues/#list-repository-issues
47-
for await (const response of octokit.paginate.iterator(
48-
"GET /repos/:owner/:repo/issues",
49-
{
50-
owner,
51-
repo,
52-
state: "open",
53-
}
54-
)) {
55-
for (const issue of response.data) {
56-
if (issue.pull_request) {
57-
// pull requests are returned in the response, but their IDs are not the
58-
continue;
59-
}
60-
61-
validateLabnels(issue);
62-
63-
console.log(`- ${issue.html_url} ${toLabelsList(issue)}`);
64-
65-
await setCard(octokit, issue);
66-
}
67-
}
68-
69-
console.log("loading pull requests");
70-
71-
// https://developer.github.com/v3/pulls/#list-pull-requests
72-
for await (const response of octokit.paginate.iterator(
73-
"GET /repos/:owner/:repo/pulls",
74-
{
75-
owner,
76-
repo,
77-
state: "open",
78-
}
79-
)) {
80-
for (const pullRequest of response.data) {
81-
validateLabnels(pullRequest);
82-
83-
console.log(
84-
`- ${pullRequest.html_url} ${toLabelsList(pullRequest)}`
85-
);
86-
87-
await setCard(octokit, pullRequest);
88-
}
89-
}
44+
// console.log(`Loading issues for ${repo}`);
45+
46+
// // https://developer.github.com/v3/issues/#list-repository-issues
47+
// for await (const response of octokit.paginate.iterator(
48+
// "GET /repos/:owner/:repo/issues",
49+
// {
50+
// owner,
51+
// repo,
52+
// state: "open",
53+
// }
54+
// )) {
55+
// for (const issue of response.data) {
56+
// if (issue.pull_request) {
57+
// // pull requests are returned in the response, but their IDs are not the
58+
// continue;
59+
// }
60+
61+
// validateLabnels(issue);
62+
63+
// console.log(`- ${issue.html_url} ${toLabelsList(issue)}`);
64+
65+
// await setCard(octokit, issue);
66+
// }
67+
// }
68+
69+
// console.log(`Loading pull requests for ${repo}`);
70+
71+
// // https://developer.github.com/v3/pulls/#list-pull-requests
72+
// for await (const response of octokit.paginate.iterator(
73+
// "GET /repos/:owner/:repo/pulls",
74+
// {
75+
// owner,
76+
// repo,
77+
// state: "open",
78+
// }
79+
// )) {
80+
// for (const pullRequest of response.data) {
81+
// validateLabnels(pullRequest);
82+
83+
// console.log(
84+
// `- ${pullRequest.html_url} ${toLabelsList(pullRequest)}`
85+
// );
86+
87+
// await setCard(octokit, pullRequest);
88+
// }
89+
// }
9090

9191
// https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository
92-
// await normalizeLabels(octokit, { owner, repo });
92+
console.log(`Normalizing labels for ${repo}`);
93+
await normalizeLabels(octokit, { owner, repo });
9394
}
9495
}
9596

lib/labels.js

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
module.exports = [
22
{
33
name: "awaiting response",
4-
description: "",
5-
color: "4c2889",
4+
description: "Clarification needed by author",
5+
color: "6f42c1",
66
},
77
{
88
name: "blocked",
99
description: "Blocked by GitHub's API or other external factors",
10-
color: "4c2889",
10+
color: "6f42c1",
1111
},
1212
{
1313
name: "bug",
14-
description: "",
15-
color: "b31d28",
14+
description: "Something isn't working as documented, or is being fixed",
15+
color: "d73a49",
1616
},
1717
{
1818
name: "dependencies",
@@ -21,24 +21,25 @@ module.exports = [
2121
},
2222
{
2323
name: "documentation",
24-
description: "",
25-
color: "111111",
24+
description: "Improvements or additions to documentation",
25+
color: "6a737d",
2626
},
2727
{
2828
name: "duplicate",
29-
description: "",
30-
color: "111111",
29+
description: "This issue or pull request already exists",
30+
color: "6a737d",
3131
},
3232
{
3333
name: "enterprise",
34-
description: "",
35-
color: "111111",
34+
description:
35+
"Applies to GitHub Enterprise Server or GitHub Enterprise Cloud",
36+
color: "6a737d",
3637
},
3738
{
3839
name: "feature",
3940
aliases: ["enhancement"],
40-
description: "",
41-
color: "044289",
41+
description: "New feature or request",
42+
color: "0366d6",
4243
},
4344
{
4445
name: "greenkeeper",
@@ -47,42 +48,47 @@ module.exports = [
4748
},
4849
{
4950
name: "good first issue",
50-
description: "",
51-
color: "176f2c",
51+
description: "Good for contributors new to Octokit",
52+
color: "22863a",
5253
},
5354
{
5455
name: "help wanted",
55-
description: "",
56-
color: "176f2c",
56+
description: "Contributions appreciated",
57+
color: "22863a",
58+
},
59+
{
60+
name: "maintenance",
61+
description: "Tests, Refactorings, Automation, etc",
62+
color: "d03592",
5763
},
5864
{
5965
name: "pinned",
60-
description: null,
66+
description: "Prevent issue/PR from being closed automatically",
6167
color: "ffffff",
6268
},
6369
{
6470
name: "released",
65-
description: "",
71+
description: "Released via semantic-release",
6672
color: "ffffff",
6773
},
6874
{
6975
name: "semantic-release",
70-
description: "",
76+
description: "Created by semantic-release",
7177
color: "ffffff",
7278
},
7379
{
7480
name: "stale",
75-
description: "",
76-
color: "4c2889",
81+
description: "Closed due to inactivity",
82+
color: "6f42c1",
7783
},
7884
{
7985
name: "support",
80-
description: "",
81-
color: "dbab09",
86+
description: "Usage questions",
87+
color: "ffd33d",
8288
},
8389
{
8490
name: "typescript",
85-
description: "",
86-
color: "111111",
91+
description: "Relevant to TypeScript users only",
92+
color: "6a737d",
8793
},
8894
];

lib/normalize-labels.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async function normalizeLabels(octokit, { owner, repo }) {
8080
});
8181
}
8282
for (const label of labelsToDelete) {
83-
// https://developer.github.com/v3/issues/labels/#update-a-label
83+
// https://developer.github.com/v3/issues/labels/#delete-a-label
8484
console.log(`Deleting label ${label.name}`);
8585
await octokit.request("DELETE /repos/:owner/:repo/labels/:name", {
8686
owner,
@@ -89,7 +89,7 @@ async function normalizeLabels(octokit, { owner, repo }) {
8989
});
9090
}
9191
for (const label of labelsToCreate) {
92-
// https://developer.github.com/v3/issues/labels/#update-a-label
92+
// https://developer.github.com/v3/issues/labels/#create-a-label
9393
console.log(`Creating label ${label.name}`);
9494
const { name, description, color } = label;
9595
await octokit.request("POST /repos/:owner/:repo/labels", {

lib/to-column-id.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module.exports = toColumnId;
33
const CATEGORY_TO_COLUMN_ID = {
44
"awaiting response": 9043179,
55
support: 9041691,
6+
maintenance: 9054373,
67
bug: 9041693,
78
feature: 9041695,
89
"in progress": 3301034,

0 commit comments

Comments
 (0)