pr-merge-queue 0.0.0-stage → 0.0.0
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/LICENSE +201 -0
- package/README.md +125 -2
- package/dist/claim-pr/claim-pr.d.mts +45 -0
- package/dist/claim-pr/claim-pr.d.mts.map +1 -0
- package/dist/claim-pr/claim-pr.mjs +217 -0
- package/dist/claim-pr/claim-pr.mjs.map +1 -0
- package/dist/claim-pr/index.d.mts +2 -0
- package/dist/claim-pr/index.d.mts.map +1 -0
- package/dist/claim-pr/index.mjs +2 -0
- package/dist/claim-pr/index.mjs.map +1 -0
- package/dist/cmd/claim-pr.d.mts +3 -0
- package/dist/cmd/claim-pr.d.mts.map +1 -0
- package/dist/cmd/claim-pr.mjs +20 -0
- package/dist/cmd/claim-pr.mjs.map +1 -0
- package/dist/cmd/open-pr.d.mts +3 -0
- package/dist/cmd/open-pr.d.mts.map +1 -0
- package/dist/cmd/open-pr.mjs +20 -0
- package/dist/cmd/open-pr.mjs.map +1 -0
- package/dist/cmd/pr-report.d.mts +3 -0
- package/dist/cmd/pr-report.d.mts.map +1 -0
- package/dist/cmd/pr-report.mjs +20 -0
- package/dist/cmd/pr-report.mjs.map +1 -0
- package/dist/cmd/push-fixed-pr.d.mts +3 -0
- package/dist/cmd/push-fixed-pr.d.mts.map +1 -0
- package/dist/cmd/push-fixed-pr.mjs +20 -0
- package/dist/cmd/push-fixed-pr.mjs.map +1 -0
- package/dist/cmd/report-unowned-prs.d.mts +3 -0
- package/dist/cmd/report-unowned-prs.d.mts.map +1 -0
- package/dist/cmd/report-unowned-prs.mjs +20 -0
- package/dist/cmd/report-unowned-prs.mjs.map +1 -0
- package/dist/cmd/unblock-prs.d.mts +3 -0
- package/dist/cmd/unblock-prs.d.mts.map +1 -0
- package/dist/cmd/unblock-prs.mjs +19 -0
- package/dist/cmd/unblock-prs.mjs.map +1 -0
- package/dist/entry-point.d.mts +3 -0
- package/dist/entry-point.d.mts.map +1 -0
- package/dist/entry-point.mjs +3 -0
- package/dist/entry-point.mjs.map +1 -0
- package/dist/lib/cli-args.d.mts +27 -0
- package/dist/lib/cli-args.d.mts.map +1 -0
- package/dist/lib/cli-args.mjs +55 -0
- package/dist/lib/cli-args.mjs.map +1 -0
- package/dist/lib/github-api.d.mts +153 -0
- package/dist/lib/github-api.d.mts.map +1 -0
- package/dist/lib/github-api.mjs +291 -0
- package/dist/lib/github-api.mjs.map +1 -0
- package/dist/lib/index.d.mts +7 -0
- package/dist/lib/index.d.mts.map +1 -0
- package/dist/lib/index.mjs +7 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/lib/json.d.mts +12 -0
- package/dist/lib/json.d.mts.map +1 -0
- package/dist/lib/json.mjs +28 -0
- package/dist/lib/json.mjs.map +1 -0
- package/dist/lib/log.d.mts +10 -0
- package/dist/lib/log.d.mts.map +1 -0
- package/dist/lib/log.mjs +13 -0
- package/dist/lib/log.mjs.map +1 -0
- package/dist/lib/shell.d.mts +18 -0
- package/dist/lib/shell.d.mts.map +1 -0
- package/dist/lib/shell.mjs +42 -0
- package/dist/lib/shell.mjs.map +1 -0
- package/dist/lib/time.d.mts +17 -0
- package/dist/lib/time.d.mts.map +1 -0
- package/dist/lib/time.mjs +35 -0
- package/dist/lib/time.mjs.map +1 -0
- package/dist/open-pr/github.d.mts +72 -0
- package/dist/open-pr/github.d.mts.map +1 -0
- package/dist/open-pr/github.mjs +249 -0
- package/dist/open-pr/github.mjs.map +1 -0
- package/dist/open-pr/index.d.mts +6 -0
- package/dist/open-pr/index.d.mts.map +1 -0
- package/dist/open-pr/index.mjs +6 -0
- package/dist/open-pr/index.mjs.map +1 -0
- package/dist/open-pr/main.d.mts +36 -0
- package/dist/open-pr/main.d.mts.map +1 -0
- package/dist/open-pr/main.mjs +204 -0
- package/dist/open-pr/main.mjs.map +1 -0
- package/dist/open-pr/options.d.mts +20 -0
- package/dist/open-pr/options.d.mts.map +1 -0
- package/dist/open-pr/options.mjs +66 -0
- package/dist/open-pr/options.mjs.map +1 -0
- package/dist/open-pr/steps.d.mts +23 -0
- package/dist/open-pr/steps.d.mts.map +1 -0
- package/dist/open-pr/steps.mjs +38 -0
- package/dist/open-pr/steps.mjs.map +1 -0
- package/dist/open-pr/types.d.mts +179 -0
- package/dist/open-pr/types.d.mts.map +1 -0
- package/dist/open-pr/types.mjs +20 -0
- package/dist/open-pr/types.mjs.map +1 -0
- package/dist/pr-report/github.d.mts +59 -0
- package/dist/pr-report/github.d.mts.map +1 -0
- package/dist/pr-report/github.mjs +561 -0
- package/dist/pr-report/github.mjs.map +1 -0
- package/dist/pr-report/index.d.mts +8 -0
- package/dist/pr-report/index.d.mts.map +1 -0
- package/dist/pr-report/index.mjs +8 -0
- package/dist/pr-report/index.mjs.map +1 -0
- package/dist/pr-report/linked-issues.d.mts +15 -0
- package/dist/pr-report/linked-issues.d.mts.map +1 -0
- package/dist/pr-report/linked-issues.mjs +39 -0
- package/dist/pr-report/linked-issues.mjs.map +1 -0
- package/dist/pr-report/main.d.mts +42 -0
- package/dist/pr-report/main.d.mts.map +1 -0
- package/dist/pr-report/main.mjs +163 -0
- package/dist/pr-report/main.mjs.map +1 -0
- package/dist/pr-report/options.d.mts +36 -0
- package/dist/pr-report/options.d.mts.map +1 -0
- package/dist/pr-report/options.mjs +90 -0
- package/dist/pr-report/options.mjs.map +1 -0
- package/dist/pr-report/queue.d.mts +28 -0
- package/dist/pr-report/queue.d.mts.map +1 -0
- package/dist/pr-report/queue.mjs +74 -0
- package/dist/pr-report/queue.mjs.map +1 -0
- package/dist/pr-report/render.d.mts +14 -0
- package/dist/pr-report/render.d.mts.map +1 -0
- package/dist/pr-report/render.mjs +318 -0
- package/dist/pr-report/render.mjs.map +1 -0
- package/dist/pr-report/repo-settings.d.mts +12 -0
- package/dist/pr-report/repo-settings.d.mts.map +1 -0
- package/dist/pr-report/repo-settings.mjs +22 -0
- package/dist/pr-report/repo-settings.mjs.map +1 -0
- package/dist/push-fixed-pr/index.d.mts +2 -0
- package/dist/push-fixed-pr/index.d.mts.map +1 -0
- package/dist/push-fixed-pr/index.mjs +2 -0
- package/dist/push-fixed-pr/index.mjs.map +1 -0
- package/dist/push-fixed-pr/push-fixed-pr.d.mts +54 -0
- package/dist/push-fixed-pr/push-fixed-pr.d.mts.map +1 -0
- package/dist/push-fixed-pr/push-fixed-pr.mjs +172 -0
- package/dist/push-fixed-pr/push-fixed-pr.mjs.map +1 -0
- package/dist/report-unowned-prs/index.d.mts +2 -0
- package/dist/report-unowned-prs/index.d.mts.map +1 -0
- package/dist/report-unowned-prs/index.mjs +2 -0
- package/dist/report-unowned-prs/index.mjs.map +1 -0
- package/dist/report-unowned-prs/report-unowned-prs.d.mts +49 -0
- package/dist/report-unowned-prs/report-unowned-prs.d.mts.map +1 -0
- package/dist/report-unowned-prs/report-unowned-prs.mjs +127 -0
- package/dist/report-unowned-prs/report-unowned-prs.mjs.map +1 -0
- package/dist/tsconfig.json +1 -0
- package/dist/unblock-prs/auto-fix.d.mts +45 -0
- package/dist/unblock-prs/auto-fix.d.mts.map +1 -0
- package/dist/unblock-prs/auto-fix.mjs +207 -0
- package/dist/unblock-prs/auto-fix.mjs.map +1 -0
- package/dist/unblock-prs/checks.d.mts +307 -0
- package/dist/unblock-prs/checks.d.mts.map +1 -0
- package/dist/unblock-prs/checks.mjs +372 -0
- package/dist/unblock-prs/checks.mjs.map +1 -0
- package/dist/unblock-prs/claims.d.mts +21 -0
- package/dist/unblock-prs/claims.d.mts.map +1 -0
- package/dist/unblock-prs/claims.mjs +23 -0
- package/dist/unblock-prs/claims.mjs.map +1 -0
- package/dist/unblock-prs/config.d.mts +487 -0
- package/dist/unblock-prs/config.d.mts.map +1 -0
- package/dist/unblock-prs/config.mjs +119 -0
- package/dist/unblock-prs/config.mjs.map +1 -0
- package/dist/unblock-prs/constants.d.mts +28 -0
- package/dist/unblock-prs/constants.d.mts.map +1 -0
- package/dist/unblock-prs/constants.mjs +28 -0
- package/dist/unblock-prs/constants.mjs.map +1 -0
- package/dist/unblock-prs/demotions.d.mts +42 -0
- package/dist/unblock-prs/demotions.d.mts.map +1 -0
- package/dist/unblock-prs/demotions.mjs +50 -0
- package/dist/unblock-prs/demotions.mjs.map +1 -0
- package/dist/unblock-prs/github.d.mts +739 -0
- package/dist/unblock-prs/github.d.mts.map +1 -0
- package/dist/unblock-prs/github.mjs +626 -0
- package/dist/unblock-prs/github.mjs.map +1 -0
- package/dist/unblock-prs/index.d.mts +25 -0
- package/dist/unblock-prs/index.d.mts.map +1 -0
- package/dist/unblock-prs/index.mjs +25 -0
- package/dist/unblock-prs/index.mjs.map +1 -0
- package/dist/unblock-prs/labels.d.mts +49 -0
- package/dist/unblock-prs/labels.d.mts.map +1 -0
- package/dist/unblock-prs/labels.mjs +49 -0
- package/dist/unblock-prs/labels.mjs.map +1 -0
- package/dist/unblock-prs/main.d.mts +179 -0
- package/dist/unblock-prs/main.d.mts.map +1 -0
- package/dist/unblock-prs/main.mjs +640 -0
- package/dist/unblock-prs/main.mjs.map +1 -0
- package/dist/unblock-prs/merge-after.d.mts +46 -0
- package/dist/unblock-prs/merge-after.d.mts.map +1 -0
- package/dist/unblock-prs/merge-after.mjs +65 -0
- package/dist/unblock-prs/merge-after.mjs.map +1 -0
- package/dist/unblock-prs/options.d.mts +35 -0
- package/dist/unblock-prs/options.d.mts.map +1 -0
- package/dist/unblock-prs/options.mjs +88 -0
- package/dist/unblock-prs/options.mjs.map +1 -0
- package/dist/unblock-prs/owner.d.mts +32 -0
- package/dist/unblock-prs/owner.d.mts.map +1 -0
- package/dist/unblock-prs/owner.mjs +63 -0
- package/dist/unblock-prs/owner.mjs.map +1 -0
- package/dist/unblock-prs/quiet.d.mts +21 -0
- package/dist/unblock-prs/quiet.d.mts.map +1 -0
- package/dist/unblock-prs/quiet.mjs +42 -0
- package/dist/unblock-prs/quiet.mjs.map +1 -0
- package/dist/unblock-prs/rebase.d.mts +120 -0
- package/dist/unblock-prs/rebase.d.mts.map +1 -0
- package/dist/unblock-prs/rebase.mjs +576 -0
- package/dist/unblock-prs/rebase.mjs.map +1 -0
- package/dist/unblock-prs/release.d.mts +62 -0
- package/dist/unblock-prs/release.d.mts.map +1 -0
- package/dist/unblock-prs/release.mjs +94 -0
- package/dist/unblock-prs/release.mjs.map +1 -0
- package/dist/unblock-prs/set-aside-comment.d.mts +20 -0
- package/dist/unblock-prs/set-aside-comment.d.mts.map +1 -0
- package/dist/unblock-prs/set-aside-comment.mjs +93 -0
- package/dist/unblock-prs/set-aside-comment.mjs.map +1 -0
- package/dist/unblock-prs/set-aside-detail.d.mts +41 -0
- package/dist/unblock-prs/set-aside-detail.d.mts.map +1 -0
- package/dist/unblock-prs/set-aside-detail.mjs +56 -0
- package/dist/unblock-prs/set-aside-detail.mjs.map +1 -0
- package/dist/unblock-prs/skips.d.mts +85 -0
- package/dist/unblock-prs/skips.d.mts.map +1 -0
- package/dist/unblock-prs/skips.mjs +141 -0
- package/dist/unblock-prs/skips.mjs.map +1 -0
- package/dist/unblock-prs/stack.d.mts +98 -0
- package/dist/unblock-prs/stack.d.mts.map +1 -0
- package/dist/unblock-prs/stack.mjs +141 -0
- package/dist/unblock-prs/stack.mjs.map +1 -0
- package/dist/unblock-prs/triage.d.mts +28 -0
- package/dist/unblock-prs/triage.d.mts.map +1 -0
- package/dist/unblock-prs/triage.mjs +396 -0
- package/dist/unblock-prs/triage.mjs.map +1 -0
- package/dist/unblock-prs/types.d.mts +793 -0
- package/dist/unblock-prs/types.d.mts.map +1 -0
- package/dist/unblock-prs/types.mjs +26 -0
- package/dist/unblock-prs/types.mjs.map +1 -0
- package/dist/unblock-prs/util.d.mts +23 -0
- package/dist/unblock-prs/util.d.mts.map +1 -0
- package/dist/unblock-prs/util.mjs +60 -0
- package/dist/unblock-prs/util.mjs.map +1 -0
- package/dist/unblock-prs/version-pr.d.mts +57 -0
- package/dist/unblock-prs/version-pr.d.mts.map +1 -0
- package/dist/unblock-prs/version-pr.mjs +79 -0
- package/dist/unblock-prs/version-pr.mjs.map +1 -0
- package/dist/unblock-prs/watch.d.mts +17 -0
- package/dist/unblock-prs/watch.d.mts.map +1 -0
- package/dist/unblock-prs/watch.mjs +128 -0
- package/dist/unblock-prs/watch.mjs.map +1 -0
- package/package.json +118 -3
- package/src/claim-pr/claim-pr.mts +380 -0
- package/src/claim-pr/claim-pr.test.mts +176 -0
- package/src/claim-pr/index.mts +1 -0
- package/src/cmd/claim-pr.mts +32 -0
- package/src/cmd/open-pr.mts +28 -0
- package/src/cmd/pr-report.mts +28 -0
- package/src/cmd/push-fixed-pr.mts +36 -0
- package/src/cmd/report-unowned-prs.mts +37 -0
- package/src/cmd/unblock-prs.mts +24 -0
- package/src/entry-point.mts +3 -0
- package/src/lib/cli-args.mts +86 -0
- package/src/lib/cli-args.test.mts +92 -0
- package/src/lib/github-api.mts +463 -0
- package/src/lib/github-api.test.mts +40 -0
- package/src/lib/index.mts +6 -0
- package/src/lib/json.mts +43 -0
- package/src/lib/json.test.mts +34 -0
- package/src/lib/log.mts +19 -0
- package/src/lib/log.test.mts +45 -0
- package/src/lib/shell.mts +52 -0
- package/src/lib/time.mts +49 -0
- package/src/open-pr/README.md +237 -0
- package/src/open-pr/github.mts +444 -0
- package/src/open-pr/index.mts +5 -0
- package/src/open-pr/main.mts +327 -0
- package/src/open-pr/options.mts +101 -0
- package/src/open-pr/options.test.mts +67 -0
- package/src/open-pr/steps.mts +57 -0
- package/src/open-pr/steps.test.mts +59 -0
- package/src/open-pr/types.mts +42 -0
- package/src/pr-report/README.md +244 -0
- package/src/pr-report/github.mts +911 -0
- package/src/pr-report/index.mts +7 -0
- package/src/pr-report/linked-issues.mts +51 -0
- package/src/pr-report/linked-issues.test.mts +65 -0
- package/src/pr-report/main.mts +257 -0
- package/src/pr-report/options.mts +140 -0
- package/src/pr-report/queue.mts +125 -0
- package/src/pr-report/render.mts +428 -0
- package/src/pr-report/render.test.mts +379 -0
- package/src/pr-report/repo-settings.mts +34 -0
- package/src/push-fixed-pr/index.mts +1 -0
- package/src/push-fixed-pr/push-fixed-pr.mts +276 -0
- package/src/push-fixed-pr/push-fixed-pr.test.mts +228 -0
- package/src/report-unowned-prs/index.mts +1 -0
- package/src/report-unowned-prs/report-unowned-prs.mts +190 -0
- package/src/report-unowned-prs/report-unowned-prs.test.mts +87 -0
- package/src/unblock-prs/README.md +1616 -0
- package/src/unblock-prs/auto-fix.mts +334 -0
- package/src/unblock-prs/auto-fix.test.mts +159 -0
- package/src/unblock-prs/checks.mts +538 -0
- package/src/unblock-prs/checks.test.mts +507 -0
- package/src/unblock-prs/claims.mts +33 -0
- package/src/unblock-prs/claims.test.mts +64 -0
- package/src/unblock-prs/config.mts +187 -0
- package/src/unblock-prs/config.schema.json +71 -0
- package/src/unblock-prs/config.test.mts +139 -0
- package/src/unblock-prs/constants.mts +33 -0
- package/src/unblock-prs/demotions.mts +73 -0
- package/src/unblock-prs/demotions.test.mts +100 -0
- package/src/unblock-prs/github.mts +1042 -0
- package/src/unblock-prs/github.test.mts +84 -0
- package/src/unblock-prs/index.mts +24 -0
- package/src/unblock-prs/labels.mts +70 -0
- package/src/unblock-prs/main.mts +1051 -0
- package/src/unblock-prs/merge-after.mts +117 -0
- package/src/unblock-prs/merge-after.test.mts +120 -0
- package/src/unblock-prs/options.mts +157 -0
- package/src/unblock-prs/owner.mts +91 -0
- package/src/unblock-prs/owner.test.mts +114 -0
- package/src/unblock-prs/quiet.mts +62 -0
- package/src/unblock-prs/quiet.test.mts +175 -0
- package/src/unblock-prs/rebase.mts +962 -0
- package/src/unblock-prs/release.mts +149 -0
- package/src/unblock-prs/release.test.mts +209 -0
- package/src/unblock-prs/set-aside-comment.mts +143 -0
- package/src/unblock-prs/set-aside-comment.test.mts +148 -0
- package/src/unblock-prs/set-aside-detail.mts +82 -0
- package/src/unblock-prs/set-aside-detail.test.mts +131 -0
- package/src/unblock-prs/skips.mts +215 -0
- package/src/unblock-prs/skips.test.mts +280 -0
- package/src/unblock-prs/stack.mts +220 -0
- package/src/unblock-prs/stack.test.mts +449 -0
- package/src/unblock-prs/triage.mts +669 -0
- package/src/unblock-prs/triage.test.mts +100 -0
- package/src/unblock-prs/types.mts +358 -0
- package/src/unblock-prs/util.mts +78 -0
- package/src/unblock-prs/util.test.mts +26 -0
- package/src/unblock-prs/version-pr.mts +112 -0
- package/src/unblock-prs/version-pr.test.mts +78 -0
- package/src/unblock-prs/watch.mts +219 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { latestMergedHead, pullRequestOfNode } from './github.mjs';
|
|
2
|
+
|
|
3
|
+
describe(pullRequestOfNode, () => {
|
|
4
|
+
const node = {
|
|
5
|
+
number: 12,
|
|
6
|
+
id: 'PR_kwDO',
|
|
7
|
+
title: 'feat: x',
|
|
8
|
+
body: 'Merge-After: #11',
|
|
9
|
+
state: 'OPEN',
|
|
10
|
+
headRefName: 'feat/x',
|
|
11
|
+
headRefOid: 'a'.repeat(40),
|
|
12
|
+
baseRefName: 'main',
|
|
13
|
+
isCrossRepository: false,
|
|
14
|
+
isDraft: false,
|
|
15
|
+
mergeStateStatus: 'BEHIND',
|
|
16
|
+
autoMergeRequest: null,
|
|
17
|
+
labels: { nodes: [{ name: 'merge-queued' }, { name: 'skip-ci' }] },
|
|
18
|
+
} as const;
|
|
19
|
+
|
|
20
|
+
test('flattens the labels to the shape every module here reads', () => {
|
|
21
|
+
assert.deepStrictEqual(pullRequestOfNode(node).labels, [
|
|
22
|
+
{ name: 'merge-queued' },
|
|
23
|
+
{ name: 'skip-ci' },
|
|
24
|
+
]);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('keeps every other field as GitHub answered it', () => {
|
|
28
|
+
const { labels: _labels, ...rest } = pullRequestOfNode(node);
|
|
29
|
+
|
|
30
|
+
const { labels: _nodeLabels, ...expected } = node;
|
|
31
|
+
|
|
32
|
+
assert.deepStrictEqual(rest, expected);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('keeps an armed auto-merge a record, which is what is read of it', () => {
|
|
36
|
+
const armed = pullRequestOfNode({
|
|
37
|
+
...node,
|
|
38
|
+
autoMergeRequest: { enabledAt: '2026-10-25T00:00:00Z' },
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
assert.deepStrictEqual(armed.autoMergeRequest, {
|
|
42
|
+
enabledAt: '2026-10-25T00:00:00Z',
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe(latestMergedHead, () => {
|
|
48
|
+
test('is the pull request merged last, and ignores one closed unmerged', () => {
|
|
49
|
+
assert.deepStrictEqual(
|
|
50
|
+
latestMergedHead([
|
|
51
|
+
pull(1, '2026-10-01T00:00:00Z'),
|
|
52
|
+
pull(3, null),
|
|
53
|
+
pull(2, '2026-10-02T00:00:00Z'),
|
|
54
|
+
]),
|
|
55
|
+
{
|
|
56
|
+
number: 2,
|
|
57
|
+
headSha: '2'.padStart(40, 'h'),
|
|
58
|
+
mergeCommit: '2'.padStart(40, 'c'),
|
|
59
|
+
},
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('is undefined when none was merged', () => {
|
|
64
|
+
assert.isUndefined(latestMergedHead([pull(3, null)]));
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('leaves the merge commit out while GitHub has none', () => {
|
|
68
|
+
assert.isUndefined(
|
|
69
|
+
latestMergedHead([pull(1, '2026-10-01T00:00:00Z', null)])?.mergeCommit,
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const pull = (
|
|
75
|
+
number: number,
|
|
76
|
+
mergedAt: string | null,
|
|
77
|
+
mergeCommit: string | null = number.toString().padStart(40, 'c'),
|
|
78
|
+
): Parameters<typeof latestMergedHead>[0][number] =>
|
|
79
|
+
({
|
|
80
|
+
number,
|
|
81
|
+
head: { sha: number.toString().padStart(40, 'h') },
|
|
82
|
+
merge_commit_sha: mergeCommit,
|
|
83
|
+
merged_at: mergedAt,
|
|
84
|
+
}) as const;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export * from './auto-fix.mjs';
|
|
2
|
+
export * from './checks.mjs';
|
|
3
|
+
export * from './claims.mjs';
|
|
4
|
+
export * from './config.mjs';
|
|
5
|
+
export * from './constants.mjs';
|
|
6
|
+
export * from './demotions.mjs';
|
|
7
|
+
export * from './github.mjs';
|
|
8
|
+
export * from './labels.mjs';
|
|
9
|
+
export * from './main.mjs';
|
|
10
|
+
export * from './merge-after.mjs';
|
|
11
|
+
export * from './options.mjs';
|
|
12
|
+
export * from './owner.mjs';
|
|
13
|
+
export * from './quiet.mjs';
|
|
14
|
+
export * from './rebase.mjs';
|
|
15
|
+
export * from './release.mjs';
|
|
16
|
+
export * from './set-aside-comment.mjs';
|
|
17
|
+
export * from './set-aside-detail.mjs';
|
|
18
|
+
export * from './skips.mjs';
|
|
19
|
+
export * from './stack.mjs';
|
|
20
|
+
export * from './triage.mjs';
|
|
21
|
+
export * from './types.mjs';
|
|
22
|
+
export * from './util.mjs';
|
|
23
|
+
export * from './version-pr.mjs';
|
|
24
|
+
export * from './watch.mjs';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the labels this script reads say about one pull request.
|
|
3
|
+
* `merge-queued` decides whether a pull request is looked at, `skip-ci`
|
|
4
|
+
* decides whether it has been released yet, and `blocks-release` decides
|
|
5
|
+
* whether the version pull request may go at all, `auto-rebase` asks for a
|
|
6
|
+
* paused pull request to be kept on the tip, and `priority:high` /
|
|
7
|
+
* `priority:low` move one within the pick order. The strings themselves are
|
|
8
|
+
* `pr-report-core`'s, because the Pull Requests Manager page reads them too.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
AUTO_REBASE_LABEL,
|
|
13
|
+
BLOCKS_RELEASE_LABEL,
|
|
14
|
+
MERGE_QUEUED_LABEL,
|
|
15
|
+
priorityOfLabels,
|
|
16
|
+
priorityRankOfLabels,
|
|
17
|
+
SKIP_CI_LABEL,
|
|
18
|
+
type QueuePriority,
|
|
19
|
+
} from 'pr-report-core';
|
|
20
|
+
import type { PullRequest } from './types.mjs';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Whether the pull request carries the `skip-ci` label, which is what this
|
|
24
|
+
* repository uses to say "not yet": the check workflows skip while it is on
|
|
25
|
+
* and `skip-ci-label.yml` holds the merge with a `pending` `no-skip-ci-label` status,
|
|
26
|
+
* so there is nothing here to unblock.
|
|
27
|
+
*/
|
|
28
|
+
export const isSkipCiLabelled = (pr: PullRequest): boolean =>
|
|
29
|
+
pr.labels.some((label) => label.name === SKIP_CI_LABEL);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Whether the pull request has been put in the queue — reviewed, and waiting
|
|
33
|
+
* for its turn rather than for someone to look at it. This is the scope rule:
|
|
34
|
+
* a pull request without the label is not this script's business, whatever
|
|
35
|
+
* else it carries.
|
|
36
|
+
*/
|
|
37
|
+
export const isMergeQueued = (pr: PullRequest): boolean =>
|
|
38
|
+
pr.labels.some((label) => label.name === MERGE_QUEUED_LABEL);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Whether the pull request declares that the release must wait for it. A
|
|
42
|
+
* draft counts: holding a release for something that is not ready yet is the
|
|
43
|
+
* case the label is for.
|
|
44
|
+
*/
|
|
45
|
+
export const blocksRelease = (pr: PullRequest): boolean =>
|
|
46
|
+
pr.labels.some((label) => label.name === BLOCKS_RELEASE_LABEL);
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Whether the pull request asked to be kept on the tip of the default branch
|
|
50
|
+
* while it waits, by `auto-rebase`, or by being queued: either way the author
|
|
51
|
+
* wants it rebased, and while `skip-ci` is on a rebase before its turn costs
|
|
52
|
+
* nothing and makes its diff easier to read.
|
|
53
|
+
*/
|
|
54
|
+
export const wantsAutoRebase = (pr: PullRequest): boolean =>
|
|
55
|
+
isMergeQueued(pr) ||
|
|
56
|
+
pr.labels.some((label) => label.name === AUTO_REBASE_LABEL);
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Which priority label the pull request carries (`priorityOfLabels`): `both`
|
|
60
|
+
* is the two at once, which contradict each other and so count as neither.
|
|
61
|
+
*/
|
|
62
|
+
export const priorityOf = (pr: PullRequest): QueuePriority =>
|
|
63
|
+
priorityOfLabels(pr.labels.map(({ name }) => name));
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Where {@link priorityOf} puts the pull request in the pick order, as a sort
|
|
67
|
+
* key: `high` before the rest, `low` after them.
|
|
68
|
+
*/
|
|
69
|
+
export const priorityRank = (pr: PullRequest): 0 | 1 | 2 =>
|
|
70
|
+
priorityRankOfLabels(pr.labels.map(({ name }) => name));
|