1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-30 16:40:57 -05:00
denoland-deno/tools/release/02_create_pr.ts
Bartek Iwańczuk 0e4d1cb5f9
feat(init): use jsr specifier for @std/assert (#23073)
This commit changes "deno init" subcommand to use "jsr:" specifier for
standard library "assert" module. It is unversioned, but we will change
it to `@^1` once `@std/assert` release version 1.0.

This allows us to start decoupling `deno` and `deno_std` release. The
release scripts have been updated to take that into account.
2024-03-27 18:51:52 +01:00

51 lines
1.7 KiB
TypeScript
Executable file

#!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { DenoWorkspace } from "./deno_workspace.ts";
import { $, createOctoKit, getGitHubRepository } from "./deps.ts";
const octoKit = createOctoKit();
const workspace = await DenoWorkspace.load();
const repo = workspace.repo;
const cliCrate = workspace.getCliCrate();
const originalBranch = await repo.gitCurrentBranch();
const newBranchName = `release_${cliCrate.version.replace(/\./, "_")}`;
// Create and push branch
$.logStep(`Creating branch ${newBranchName}...`);
await repo.gitBranch(newBranchName);
await repo.gitAdd();
await repo.gitCommit(cliCrate.version);
$.logStep("Pushing branch...");
await repo.gitPush("-u", "origin", "HEAD");
// Open PR
$.logStep("Opening PR...");
const openedPr = await octoKit.request("POST /repos/{owner}/{repo}/pulls", {
...getGitHubRepository(),
base: originalBranch,
head: newBranchName,
draft: true,
title: cliCrate.version,
body: getPrBody(),
});
$.log(`Opened PR at ${openedPr.data.url}`);
function getPrBody() {
let text = `Bumped versions for ${cliCrate.version}\n\n` +
`Please ensure:\n` +
`- [ ] Target branch is correct (\`vX.XX\` if a patch release, \`main\` if minor)\n` +
`- [ ] Crate versions are bumped correctly\n` +
`- [ ] Releases.md is updated correctly (think relevancy and remove reverts)\n\n` +
`To make edits to this PR:\n` +
"```shell\n" +
`git fetch upstream ${newBranchName} && git checkout -b ${newBranchName} upstream/${newBranchName}\n` +
"```\n";
const actor = Deno.env.get("GH_WORKFLOW_ACTOR");
if (actor != null) {
text += `\ncc @${actor}`;
}
return text;
}