next-issue 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/github.mjs +6 -4
- package/dist/pipeline.mjs +9 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -284,7 +284,7 @@ does not know all stop the run, so a typo cannot pass without a word.
|
|
|
284
284
|
| Field | Default | Effect |
|
|
285
285
|
| --- | --- | --- |
|
|
286
286
|
| `remote` | `origin` | The git remote for the repository and the branches |
|
|
287
|
-
| `issueLimit` | `100` | The maximum number of open issues to read |
|
|
287
|
+
| `issueLimit` | `100` | The maximum number of open issues to read. With `labels.ready` set, only issues with the ready, in-progress or in-review label count |
|
|
288
288
|
| `maxCiFixes` | `5` | The budget for check fixes per issue |
|
|
289
289
|
| `maxCommitFixes` | `10` | The budget for fixes of a commit that a git hook stopped, per issue |
|
|
290
290
|
| `maxReviewRounds` | `5` | The budget for review rounds per issue |
|
package/dist/github.mjs
CHANGED
|
@@ -44,14 +44,15 @@ function toIssue(item) {
|
|
|
44
44
|
labels: item.labels.map((label) => label.name),
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
export async function openIssues(repo, limit) {
|
|
47
|
+
export async function openIssues(repo, limit, labels) {
|
|
48
|
+
const filter = labels.length === 0 ? "" : ` label:${labels.map((label) => `"${label}"`).join(",")}`;
|
|
48
49
|
const raw = await gh(repo, [
|
|
49
50
|
"issue",
|
|
50
51
|
"list",
|
|
51
52
|
"--state",
|
|
52
53
|
"open",
|
|
53
54
|
"--search",
|
|
54
|
-
|
|
55
|
+
`sort:created-asc${filter}`,
|
|
55
56
|
"--limit",
|
|
56
57
|
String(limit),
|
|
57
58
|
"--json",
|
|
@@ -61,8 +62,9 @@ export async function openIssues(repo, limit) {
|
|
|
61
62
|
return parsed.map(toIssue).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
62
63
|
}
|
|
63
64
|
export async function viewIssue(repo, issue) {
|
|
64
|
-
const raw = await gh(repo, ["issue", "view", String(issue), "--json", ISSUE_FIELDS]);
|
|
65
|
-
|
|
65
|
+
const raw = await gh(repo, ["issue", "view", String(issue), "--json", `${ISSUE_FIELDS},state`]);
|
|
66
|
+
const parsed = JSON.parse(raw);
|
|
67
|
+
return { ...toIssue(parsed), open: parsed.state === "OPEN" };
|
|
66
68
|
}
|
|
67
69
|
export async function issueComments(repo, issue) {
|
|
68
70
|
const raw = await gh(repo, ["issue", "view", String(issue), "--json", "comments"]);
|
package/dist/pipeline.mjs
CHANGED
|
@@ -60,15 +60,21 @@ export function skipReason(issue, config, resuming) {
|
|
|
60
60
|
}
|
|
61
61
|
export async function pendingIssues(context) {
|
|
62
62
|
const { repo, config, ports } = context;
|
|
63
|
-
const
|
|
63
|
+
const { ready, inProgress, inReview } = config.labels;
|
|
64
|
+
const labels = ready.length === 0 ? [] : [ready, inProgress, inReview];
|
|
65
|
+
const issues = await ports.openIssues(repo, config.issueLimit, labels);
|
|
64
66
|
const listed = new Set(issues.map((issue) => issue.number));
|
|
65
67
|
for (const number of await savedIssues(repo)) {
|
|
66
68
|
if (listed.has(number)) {
|
|
67
69
|
continue;
|
|
68
70
|
}
|
|
69
71
|
const saved = await readState(repo, number).catch(() => undefined);
|
|
70
|
-
if (saved
|
|
71
|
-
|
|
72
|
+
if (saved === undefined) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const { open, ...issue } = await ports.viewIssue(repo, number);
|
|
76
|
+
if (open || (saved.pr !== undefined && (await ports.prMerged(repo, saved.pr)))) {
|
|
77
|
+
issues.push(issue);
|
|
72
78
|
}
|
|
73
79
|
}
|
|
74
80
|
return issues.sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|