@ucdjs/release-scripts 0.1.0-beta.27 → 0.1.0-beta.28
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/dist/index.mjs +31 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -586,6 +586,16 @@ var GitHubService = class extends Effect.Service()("@ucdjs/release-scripts/GitHu
|
|
|
586
586
|
cause: e.cause
|
|
587
587
|
})));
|
|
588
588
|
}
|
|
589
|
+
function createPullRequest(options) {
|
|
590
|
+
return makeRequest("pulls", PullRequestSchema, {
|
|
591
|
+
method: "POST",
|
|
592
|
+
body: JSON.stringify(options)
|
|
593
|
+
}).pipe(Effect.mapError((e) => new GitHubError({
|
|
594
|
+
message: e.message,
|
|
595
|
+
operation: "createPullRequest",
|
|
596
|
+
cause: e.cause
|
|
597
|
+
})));
|
|
598
|
+
}
|
|
589
599
|
const prBodyTemplate = `## Release Summary
|
|
590
600
|
|
|
591
601
|
This PR prepares the release of <%= it.count %> package<%= it.count === 1 ? "" : "s" %>:
|
|
@@ -609,6 +619,7 @@ See individual package changelogs for details.
|
|
|
609
619
|
return {
|
|
610
620
|
getPullRequestByBranch,
|
|
611
621
|
setCommitStatus,
|
|
622
|
+
createPullRequest,
|
|
612
623
|
updatePullRequest,
|
|
613
624
|
generateReleasePRBody
|
|
614
625
|
};
|
|
@@ -1168,8 +1179,26 @@ function constructPrepareProgram(config) {
|
|
|
1168
1179
|
const versionCalculator = yield* VersionCalculatorService;
|
|
1169
1180
|
const workspace = yield* WorkspaceService;
|
|
1170
1181
|
yield* git.workspace.assertWorkspaceReady;
|
|
1171
|
-
|
|
1172
|
-
|
|
1182
|
+
if (!(yield* git.branches.exists(config.branch.release))) {
|
|
1183
|
+
yield* Console.log(`🌿 Creating release branch "${config.branch.release}" from "${config.branch.default}"...`);
|
|
1184
|
+
yield* git.branches.create(config.branch.release, config.branch.default);
|
|
1185
|
+
yield* Console.log(`✅ Release branch created.`);
|
|
1186
|
+
}
|
|
1187
|
+
let releasePullRequest = yield* github.getPullRequestByBranch(config.branch.release);
|
|
1188
|
+
if (!releasePullRequest) {
|
|
1189
|
+
yield* Console.log(`📋 Creating release pull request...`);
|
|
1190
|
+
yield* git.branches.checkout(config.branch.release);
|
|
1191
|
+
yield* git.commits.push(config.branch.release);
|
|
1192
|
+
releasePullRequest = yield* github.createPullRequest({
|
|
1193
|
+
title: config.pullRequest.title,
|
|
1194
|
+
body: config.pullRequest.body,
|
|
1195
|
+
head: config.branch.release,
|
|
1196
|
+
base: config.branch.default,
|
|
1197
|
+
draft: true
|
|
1198
|
+
});
|
|
1199
|
+
yield* Console.log(`✅ Release pull request #${releasePullRequest.number} created.`);
|
|
1200
|
+
}
|
|
1201
|
+
if (!releasePullRequest.head) return yield* Effect.fail(/* @__PURE__ */ new Error(`Release pull request for branch "${config.branch.release}" has no head SHA.`));
|
|
1173
1202
|
yield* Console.log(`✅ Release pull request #${releasePullRequest.number} exists.`);
|
|
1174
1203
|
if ((yield* git.branches.get) !== config.branch.release) {
|
|
1175
1204
|
yield* git.branches.checkout(config.branch.release);
|