mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-25 06:40:30 +08:00
27 lines
650 B
TypeScript
27 lines
650 B
TypeScript
import type { RadiclePeer } from "@tests/support/peerManager.js";
|
|
import type { Options } from "execa";
|
|
|
|
export async function create(
|
|
peer: RadiclePeer,
|
|
title: string,
|
|
description: string,
|
|
labels: string[],
|
|
options: Options,
|
|
): Promise<string> {
|
|
const issueOptions: string[] = [
|
|
"issue",
|
|
"open",
|
|
"--title",
|
|
title,
|
|
"--description",
|
|
description,
|
|
...labels.map(label => ["--label", label]).flat(),
|
|
];
|
|
const { stdout } = await peer.rad(issueOptions, options);
|
|
const match = stdout.match(/Issue {3}([a-zA-Z0-9]*)/);
|
|
if (!match) {
|
|
throw new Error("Not able to parse issue id");
|
|
}
|
|
return match[1];
|
|
}
|