create-typescript-app 2.4.0 → 2.4.2
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.
|
@@ -8,22 +8,45 @@ const blockRepositoryBranchRuleset = base.createBlock({
|
|
|
8
8
|
requiredStatusChecks: z.array(z.string()).default([])
|
|
9
9
|
},
|
|
10
10
|
setup({ addons, options }) {
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
return {
|
|
12
|
+
requests: [
|
|
13
|
+
{
|
|
14
|
+
id: "branch-ruleset-create",
|
|
15
|
+
async send({ octokit }) {
|
|
16
|
+
await octokit.request(
|
|
17
|
+
"POST /repos/{owner}/{repo}/rulesets",
|
|
18
|
+
createInnerSend(addons.requiredStatusChecks, options)
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
};
|
|
18
24
|
},
|
|
19
25
|
transition({ addons, options }) {
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
return {
|
|
27
|
+
requests: [
|
|
28
|
+
{
|
|
29
|
+
id: "branch-ruleset-update",
|
|
30
|
+
async send({ octokit }) {
|
|
31
|
+
if (options.rulesetId) {
|
|
32
|
+
await octokit.request(
|
|
33
|
+
`PUT /repos/{owner}/{repo}/rulesets/{ruleset_id}`,
|
|
34
|
+
createInnerSend(
|
|
35
|
+
addons.requiredStatusChecks,
|
|
36
|
+
options,
|
|
37
|
+
options.rulesetId
|
|
38
|
+
)
|
|
39
|
+
);
|
|
40
|
+
} else {
|
|
41
|
+
await octokit.request(
|
|
42
|
+
`POST /repos/{owner}/{repo}/rulesets/{ruleset_id}`,
|
|
43
|
+
createInnerSend(addons.requiredStatusChecks, options)
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
};
|
|
27
50
|
},
|
|
28
51
|
// TODO: Make produce() optional
|
|
29
52
|
// This needs createBlock to be generic to know if block.produce({}) is ok
|
|
@@ -31,61 +54,54 @@ const blockRepositoryBranchRuleset = base.createBlock({
|
|
|
31
54
|
return {};
|
|
32
55
|
}
|
|
33
56
|
});
|
|
34
|
-
function
|
|
57
|
+
function createInnerSend(contexts, options, rulesetId) {
|
|
35
58
|
return {
|
|
36
|
-
|
|
59
|
+
bypass_actors: [
|
|
37
60
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
context
|
|
77
|
-
})),
|
|
78
|
-
strict_required_status_checks_policy: false
|
|
79
|
-
},
|
|
80
|
-
type: "required_status_checks"
|
|
81
|
-
}
|
|
82
|
-
],
|
|
83
|
-
ruleset_id: rulesetId,
|
|
84
|
-
target: "branch"
|
|
85
|
-
});
|
|
86
|
-
}
|
|
61
|
+
// This *seems* to be the Repository Admin role always?
|
|
62
|
+
// https://github.com/github/rest-api-description/issues/4406
|
|
63
|
+
actor_id: 5,
|
|
64
|
+
actor_type: "RepositoryRole",
|
|
65
|
+
bypass_mode: "always"
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
conditions: {
|
|
69
|
+
ref_name: {
|
|
70
|
+
exclude: [],
|
|
71
|
+
include: ["refs/heads/main"]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
enforcement: "active",
|
|
75
|
+
name: "Branch protection for main",
|
|
76
|
+
owner: options.owner,
|
|
77
|
+
repo: options.repository,
|
|
78
|
+
rules: [
|
|
79
|
+
{ type: "deletion" },
|
|
80
|
+
{
|
|
81
|
+
parameters: {
|
|
82
|
+
allowed_merge_methods: ["squash"],
|
|
83
|
+
dismiss_stale_reviews_on_push: false,
|
|
84
|
+
require_code_owner_review: false,
|
|
85
|
+
require_last_push_approval: false,
|
|
86
|
+
required_approving_review_count: 0,
|
|
87
|
+
required_review_thread_resolution: false
|
|
88
|
+
},
|
|
89
|
+
type: "pull_request"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
parameters: {
|
|
93
|
+
required_status_checks: contexts.map((context) => ({
|
|
94
|
+
context
|
|
95
|
+
})),
|
|
96
|
+
strict_required_status_checks_policy: false
|
|
97
|
+
},
|
|
98
|
+
type: "required_status_checks"
|
|
87
99
|
}
|
|
88
|
-
]
|
|
100
|
+
],
|
|
101
|
+
// Type fun because the GitHub Octokit APIs don't provide named types...
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
103
|
+
ruleset_id: rulesetId === void 0 ? rulesetId : Number(rulesetId),
|
|
104
|
+
target: "branch"
|
|
89
105
|
};
|
|
90
106
|
}
|
|
91
107
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AllContributorContributor } from '../types.js';
|
|
2
2
|
import { TakeInput } from 'bingo';
|
|
3
3
|
|
|
4
|
-
declare function readAllContributors(take: TakeInput): Promise<AllContributorContributor[]>;
|
|
4
|
+
declare function readAllContributors(take: TakeInput): Promise<AllContributorContributor[] | undefined>;
|
|
5
5
|
|
|
6
6
|
export { readAllContributors };
|