next-issue 6.6.85 → 6.6.87
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 +8 -5
- package/dist/base-checks.mjs +17 -14
- package/dist/gate.mjs +3 -3
- package/dist/revert.mjs +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -154,13 +154,15 @@ the run handles one issue. For each issue:
|
|
|
154
154
|
next run after that hand-over, checks the base on resume and waits for
|
|
155
155
|
the checks of the commit when it landed. The harness then waits for the
|
|
156
156
|
checks of the pushed commit on the base branch: the GitHub Actions
|
|
157
|
-
workflow runs that a `push`
|
|
158
|
-
and the check runs of every other GitHub App, so checks
|
|
159
|
-
service count too. It leaves out the check runs of the GitHub Actions
|
|
157
|
+
workflow runs that a `push` of the base branch started on it, its
|
|
158
|
+
commit statuses and the check runs of every other GitHub App, so checks
|
|
159
|
+
from another CI service count too. It leaves out the check runs of the GitHub Actions
|
|
160
160
|
app, since it judges GitHub Actions by its workflow runs. It leaves out
|
|
161
161
|
workflow runs that any other event (such as `issues`, `issue_comment` or
|
|
162
162
|
`schedule`) started, since GitHub gives such a run the tip of the
|
|
163
|
-
default branch as its commit.
|
|
163
|
+
default branch as its commit. It also leaves out the `push` runs that a
|
|
164
|
+
push of a tag or of another branch started on the same commit, such as
|
|
165
|
+
a release or a deploy. A failed or errored commit status, or a
|
|
164
166
|
check run that ends with `failure`, `timed_out` or `action_required`,
|
|
165
167
|
fails the checks. When any check ends `cancelled`, for example because
|
|
166
168
|
a later push cancelled the workflow run, that check never finished,
|
|
@@ -327,7 +329,8 @@ Press `Ctrl-C` to stop the run step by step:
|
|
|
327
329
|
commit reached the base branch, the next run drops those edits and any
|
|
328
330
|
unfinished merge of the base branch, then lands the change with no new
|
|
329
331
|
review round. A hand-over of the issue cancels that approval, so the
|
|
330
|
-
issue resumes in review.
|
|
332
|
+
issue resumes in review. A revert of the landed change cancels it too,
|
|
333
|
+
even when the hand-over after it does not finish.
|
|
331
334
|
|
|
332
335
|
Signals that arrive within 100 ms of the last counted one count as one press,
|
|
333
336
|
because `npx` and `npm exec` pass on a press as a second signal.
|
package/dist/base-checks.mjs
CHANGED
|
@@ -13,9 +13,9 @@ function jsonLines(raw) {
|
|
|
13
13
|
.filter((line) => line.trim() !== '')
|
|
14
14
|
.map((line) => JSON.parse(line));
|
|
15
15
|
}
|
|
16
|
-
async function baseRuns(repo, sha) {
|
|
17
|
-
const runs = await ghApi(repo, `actions/runs?head_sha=${sha}&per_page=100`, '.workflow_runs[] | {databaseId: .id, name, status, conclusion: (.conclusion // ""), attempt: .run_attempt, event} | @json', { paginate: true });
|
|
18
|
-
return jsonLines(runs).filter((entry) => entry.event === 'push');
|
|
16
|
+
async function baseRuns(repo, sha, branch) {
|
|
17
|
+
const runs = await ghApi(repo, `actions/runs?head_sha=${sha}&per_page=100`, '.workflow_runs[] | {databaseId: .id, name, status, conclusion: (.conclusion // ""), attempt: .run_attempt, event, branch: (.head_branch // "")} | @json', { paginate: true });
|
|
18
|
+
return jsonLines(runs).filter((entry) => entry.event === 'push' && entry.branch === branch);
|
|
19
19
|
}
|
|
20
20
|
async function externalChecks(repo, sha) {
|
|
21
21
|
const [runs, statuses] = await Promise.all([
|
|
@@ -38,8 +38,11 @@ async function externalChecks(repo, sha) {
|
|
|
38
38
|
}));
|
|
39
39
|
return [...checkRuns, ...commitStatuses];
|
|
40
40
|
}
|
|
41
|
-
async function baseChecks(repo, sha) {
|
|
42
|
-
const [runs, external] = await Promise.all([
|
|
41
|
+
async function baseChecks(repo, sha, branch) {
|
|
42
|
+
const [runs, external] = await Promise.all([
|
|
43
|
+
baseRuns(repo, sha, branch),
|
|
44
|
+
externalChecks(repo, sha),
|
|
45
|
+
]);
|
|
43
46
|
return [...runs.map((entry) => ({ ...entry, url: '' })), ...external];
|
|
44
47
|
}
|
|
45
48
|
function failedRun(entry) {
|
|
@@ -54,30 +57,30 @@ function baseState(runs) {
|
|
|
54
57
|
}
|
|
55
58
|
return runs.some((entry) => entry.conclusion === 'cancelled') ? 'cancelled' : 'pass';
|
|
56
59
|
}
|
|
57
|
-
export function waitForBaseChecks(repo, sha, options) {
|
|
60
|
+
export function waitForBaseChecks(repo, sha, branch, options) {
|
|
58
61
|
let checks = [];
|
|
59
62
|
return pollChecks({
|
|
60
63
|
head: async () => sha,
|
|
61
64
|
lags: async () => true,
|
|
62
65
|
list: async () => {
|
|
63
|
-
checks = await baseChecks(repo, sha);
|
|
66
|
+
checks = await baseChecks(repo, sha, branch);
|
|
64
67
|
return checks.length === 0 ? 'none' : 'some';
|
|
65
68
|
},
|
|
66
69
|
watch: async () => baseState(checks),
|
|
67
70
|
}, options);
|
|
68
71
|
}
|
|
69
|
-
export async function rerunFailedBase(repo, sha, started = () => { }) {
|
|
70
|
-
const failed = (await baseRuns(repo, sha)).filter(failedRun);
|
|
72
|
+
export async function rerunFailedBase(repo, sha, branch, started = () => { }) {
|
|
73
|
+
const failed = (await baseRuns(repo, sha, branch)).filter(failedRun);
|
|
71
74
|
for (const entry of failed) {
|
|
72
75
|
await gh(repo, ['run', 'rerun', String(entry.databaseId), '--failed']);
|
|
73
76
|
}
|
|
74
77
|
started();
|
|
75
|
-
await waitForRestart(repo, sha, failed);
|
|
78
|
+
await waitForRestart(repo, sha, branch, failed);
|
|
76
79
|
return failed.map((entry) => String(entry.databaseId));
|
|
77
80
|
}
|
|
78
|
-
async function waitForRestart(repo, sha, failed) {
|
|
81
|
+
async function waitForRestart(repo, sha, branch, failed) {
|
|
79
82
|
for (let attempt = 1; attempt <= RESTART_TRIES; attempt += 1) {
|
|
80
|
-
const runs = await baseRuns(repo, sha);
|
|
83
|
+
const runs = await baseRuns(repo, sha, branch);
|
|
81
84
|
const restarted = failed.every((entry) => runs.some((run) => run.databaseId === entry.databaseId && run.attempt > entry.attempt));
|
|
82
85
|
if (restarted) {
|
|
83
86
|
return;
|
|
@@ -85,8 +88,8 @@ async function waitForRestart(repo, sha, failed) {
|
|
|
85
88
|
await delay(secondsToMs(1));
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
|
-
export async function failedBaseLogs(repo, sha, maxChars) {
|
|
89
|
-
const failed = (await baseRuns(repo, sha))
|
|
91
|
+
export async function failedBaseLogs(repo, sha, branch, maxChars) {
|
|
92
|
+
const failed = (await baseRuns(repo, sha, branch))
|
|
90
93
|
.filter(failedRun)
|
|
91
94
|
.map((entry) => ({ heading: `## ${entry.name}`, runId: String(entry.databaseId) }));
|
|
92
95
|
const external = (await externalChecks(repo, sha)).filter(failedRun).map((entry) => ({
|
package/dist/gate.mjs
CHANGED
|
@@ -34,7 +34,7 @@ export async function checkGate(job, sha) {
|
|
|
34
34
|
async function waitForChecks(job, sha, fields = {}) {
|
|
35
35
|
const { context, log } = job;
|
|
36
36
|
const { repo, config, ports } = context;
|
|
37
|
-
const checks = await log.step('main-checks', { sha, ...fields }, () => ports.waitForBaseChecks(repo, sha, checkWaiting(config, true)));
|
|
37
|
+
const checks = await log.step('main-checks', { sha, ...fields }, () => ports.waitForBaseChecks(repo, sha, context.base, checkWaiting(config, true)));
|
|
38
38
|
log.event('main-checks.state', { state: checks, ...fields });
|
|
39
39
|
return checks;
|
|
40
40
|
}
|
|
@@ -48,7 +48,7 @@ async function rerunOnce(job, sha, checks) {
|
|
|
48
48
|
await writeState(context.repo, state);
|
|
49
49
|
let started = false;
|
|
50
50
|
try {
|
|
51
|
-
const runs = await context.ports.rerunFailedBase(context.repo, sha, () => {
|
|
51
|
+
const runs = await context.ports.rerunFailedBase(context.repo, sha, context.base, () => {
|
|
52
52
|
started = true;
|
|
53
53
|
});
|
|
54
54
|
log.event('main-checks.rerun', { sha, runs });
|
|
@@ -82,7 +82,7 @@ async function failedChecksFix(job, sha) {
|
|
|
82
82
|
await writeState(repo, state);
|
|
83
83
|
let logs;
|
|
84
84
|
try {
|
|
85
|
-
logs = await ports.failedBaseLogs(repo, sha, config.logMaxChars);
|
|
85
|
+
logs = await ports.failedBaseLogs(repo, sha, base, config.logMaxChars);
|
|
86
86
|
}
|
|
87
87
|
catch (error) {
|
|
88
88
|
return escalateError(job, error, `The read of the failed checks on ${base} failed`, 'logs error');
|
package/dist/revert.mjs
CHANGED
|
@@ -31,6 +31,9 @@ export function restoreChange(state) {
|
|
|
31
31
|
state.landed = undefined;
|
|
32
32
|
state.title = state.changeTitle ?? state.title;
|
|
33
33
|
state.changeTitle = undefined;
|
|
34
|
+
if (state.phase === 'approved') {
|
|
35
|
+
state.phase = 'review';
|
|
36
|
+
}
|
|
34
37
|
}
|
|
35
38
|
export async function revert(job) {
|
|
36
39
|
const { context, issue, log, state, branch, worktree } = job;
|