next-issue 6.6.30 → 6.6.32
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 +14 -3
- package/dist/base-checks.mjs +51 -5
- package/dist/conflict.mjs +1 -0
- package/dist/gate.mjs +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -132,7 +132,16 @@ the run handles one issue. For each issue:
|
|
|
132
132
|
during the push, so a run stopped meanwhile, or the next run after that
|
|
133
133
|
hand-over, checks the base on resume and waits for the checks of the
|
|
134
134
|
commit when it landed. The harness then waits for the checks of the
|
|
135
|
-
pushed commit on the base branch
|
|
135
|
+
pushed commit on the base branch: its GitHub Actions workflow runs, its
|
|
136
|
+
commit statuses and the check runs of every other GitHub App, so checks
|
|
137
|
+
from another CI service count too. It leaves out the check runs of the
|
|
138
|
+
GitHub Actions app, since it judges GitHub Actions by its workflow runs. A
|
|
139
|
+
failed or errored commit status, or a check run that ends with
|
|
140
|
+
`failure`, `timed_out` or `action_required`, fails the checks. When a check
|
|
141
|
+
ends `cancelled` and none ends `success`, for example because a later push
|
|
142
|
+
cancelled the workflow run, no check of the commit finished: the harness
|
|
143
|
+
hands the issue to a person with the reason `main checks cancelled` and
|
|
144
|
+
halts, and the issue stays open. A repository
|
|
136
145
|
that reports no check keeps asking for `checkGraceSeconds`. A pending state
|
|
137
146
|
waits again, up to `checkTimeoutMinutes`. A read that fails is tried three
|
|
138
147
|
times. When the checks pass, the harness closes the issue and sets
|
|
@@ -141,10 +150,12 @@ the run handles one issue. For each issue:
|
|
|
141
150
|
and the state file go away. A fetch that fails or a fast-forward that is
|
|
142
151
|
not safe leaves the local base branch as it is and writes a `base.behind`
|
|
143
152
|
event, and the issue is still done. When the checks fail, the harness
|
|
144
|
-
reruns the failed jobs once with
|
|
153
|
+
reruns the failed GitHub Actions jobs once with
|
|
154
|
+
`gh run rerun <id> --failed`, records a
|
|
145
155
|
`main-checks.rerun` event, saves the rerun in the state file and waits
|
|
146
156
|
again once the runs restart. When the rerun cannot start, or the checks
|
|
147
|
-
fail again, the fixer gets their logs from the check budget
|
|
157
|
+
fail again, the fixer gets their logs from the check budget (for a check
|
|
158
|
+
from another CI service, only its name and link), and its fix
|
|
148
159
|
lands the same way. When the fixer cannot fix them, its fix cannot land,
|
|
149
160
|
an error stops the fix, or the budget runs out, the harness reverts every
|
|
150
161
|
commit of the change on the base branch, pushes the revert and hands the
|
package/dist/base-checks.mjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { setTimeout as delay } from 'node:timers/promises';
|
|
2
2
|
import { pollChecks } from './check-poll.mjs';
|
|
3
3
|
import { secondsToMs } from './durations.mjs';
|
|
4
|
-
import { gh, ghJson } from './gh.mjs';
|
|
4
|
+
import { gh, ghApi, ghJson } from './gh.mjs';
|
|
5
5
|
import { runLogs } from './run-logs.mjs';
|
|
6
6
|
const RESTART_TRIES = 10;
|
|
7
|
+
const ACTIONS_APP = 'github-actions';
|
|
8
|
+
const FAILED_STATES = new Set(['failure', 'error']);
|
|
7
9
|
const FAILED_CONCLUSIONS = new Set(['failure', 'timed_out', 'startup_failure']);
|
|
8
10
|
async function baseRuns(repo, sha) {
|
|
9
11
|
return ghJson(repo, [
|
|
@@ -15,6 +17,37 @@ async function baseRuns(repo, sha) {
|
|
|
15
17
|
'databaseId,name,status,conclusion,attempt',
|
|
16
18
|
]);
|
|
17
19
|
}
|
|
20
|
+
function jsonLines(raw) {
|
|
21
|
+
return raw
|
|
22
|
+
.split('\n')
|
|
23
|
+
.filter((line) => line.trim() !== '')
|
|
24
|
+
.map((line) => JSON.parse(line));
|
|
25
|
+
}
|
|
26
|
+
async function externalChecks(repo, sha) {
|
|
27
|
+
const [runs, statuses] = await Promise.all([
|
|
28
|
+
ghApi(repo, `commits/${sha}/check-runs?per_page=100`, '.check_runs[] | {name, status, conclusion, app: .app.slug, url: .details_url} | @json', { paginate: true }),
|
|
29
|
+
ghApi(repo, `commits/${sha}/status?per_page=100`, '.statuses[] | {name: .context, state, url: .target_url} | @json', { paginate: true }),
|
|
30
|
+
]);
|
|
31
|
+
const checkRuns = jsonLines(runs)
|
|
32
|
+
.filter((entry) => entry.app !== ACTIONS_APP)
|
|
33
|
+
.map((entry) => ({
|
|
34
|
+
name: entry.name,
|
|
35
|
+
status: entry.status,
|
|
36
|
+
conclusion: entry.conclusion === 'action_required' ? 'failure' : (entry.conclusion ?? ''),
|
|
37
|
+
url: entry.url ?? '',
|
|
38
|
+
}));
|
|
39
|
+
const commitStatuses = jsonLines(statuses).map((entry) => ({
|
|
40
|
+
name: entry.name,
|
|
41
|
+
status: entry.state === 'pending' ? 'pending' : 'completed',
|
|
42
|
+
conclusion: FAILED_STATES.has(entry.state) ? 'failure' : entry.state,
|
|
43
|
+
url: entry.url ?? '',
|
|
44
|
+
}));
|
|
45
|
+
return [...checkRuns, ...commitStatuses];
|
|
46
|
+
}
|
|
47
|
+
async function baseChecks(repo, sha) {
|
|
48
|
+
const [runs, external] = await Promise.all([baseRuns(repo, sha), externalChecks(repo, sha)]);
|
|
49
|
+
return [...runs.map((entry) => ({ ...entry, url: '' })), ...external];
|
|
50
|
+
}
|
|
18
51
|
function failedRun(entry) {
|
|
19
52
|
return entry.status === 'completed' && FAILED_CONCLUSIONS.has(entry.conclusion);
|
|
20
53
|
}
|
|
@@ -22,14 +55,23 @@ function baseState(runs) {
|
|
|
22
55
|
if (runs.some(failedRun)) {
|
|
23
56
|
return 'fail';
|
|
24
57
|
}
|
|
25
|
-
|
|
58
|
+
if (!runs.every((entry) => entry.status === 'completed')) {
|
|
59
|
+
return 'pending';
|
|
60
|
+
}
|
|
61
|
+
const cancelled = runs.some((entry) => entry.conclusion === 'cancelled');
|
|
62
|
+
const succeeded = runs.some((entry) => entry.conclusion === 'success');
|
|
63
|
+
return cancelled && !succeeded ? 'cancelled' : 'pass';
|
|
26
64
|
}
|
|
27
65
|
export function waitForBaseChecks(repo, sha, options) {
|
|
66
|
+
let checks = [];
|
|
28
67
|
return pollChecks({
|
|
29
68
|
head: async () => sha,
|
|
30
69
|
lags: async () => true,
|
|
31
|
-
list: async () =>
|
|
32
|
-
|
|
70
|
+
list: async () => {
|
|
71
|
+
checks = await baseChecks(repo, sha);
|
|
72
|
+
return checks.length === 0 ? 'none' : 'some';
|
|
73
|
+
},
|
|
74
|
+
watch: async () => baseState(checks),
|
|
33
75
|
}, options);
|
|
34
76
|
}
|
|
35
77
|
export async function rerunFailedBase(repo, sha) {
|
|
@@ -54,5 +96,9 @@ export async function failedBaseLogs(repo, sha, maxChars) {
|
|
|
54
96
|
const failed = (await baseRuns(repo, sha))
|
|
55
97
|
.filter(failedRun)
|
|
56
98
|
.map((entry) => ({ heading: `## ${entry.name}`, runId: String(entry.databaseId) }));
|
|
57
|
-
|
|
99
|
+
const external = (await externalChecks(repo, sha)).filter(failedRun).map((entry) => ({
|
|
100
|
+
heading: entry.url === '' ? `## ${entry.name}` : `## ${entry.name}\n${entry.url}`,
|
|
101
|
+
runId: undefined,
|
|
102
|
+
}));
|
|
103
|
+
return runLogs(repo, [...failed, ...external], maxChars);
|
|
58
104
|
}
|
package/dist/conflict.mjs
CHANGED
|
@@ -15,6 +15,7 @@ export async function rebase(job) {
|
|
|
15
15
|
if (merged !== undefined) {
|
|
16
16
|
return merged;
|
|
17
17
|
}
|
|
18
|
+
state.title = title;
|
|
18
19
|
}
|
|
19
20
|
const merged = await ports.revision(worktree);
|
|
20
21
|
const squashed = await commitWork(job, merged, title, 'fixer', (cwd, message) => ports.squashOnto(cwd, base, config.remote, message));
|
package/dist/gate.mjs
CHANGED
|
@@ -23,6 +23,9 @@ export async function checkGate(job, sha) {
|
|
|
23
23
|
return GATE_PASSED;
|
|
24
24
|
}
|
|
25
25
|
job.mainBroken = true;
|
|
26
|
+
if (checks === 'cancelled') {
|
|
27
|
+
return escalateAndFinish(job, `The checks on ${base} were cancelled before they finished.`, 'main checks cancelled');
|
|
28
|
+
}
|
|
26
29
|
if (checks !== 'fail') {
|
|
27
30
|
return escalateAndFinish(job, `The checks on ${base} did not finish in time.`, 'main checks timeout');
|
|
28
31
|
}
|