22 lines
604 B
TypeScript
22 lines
604 B
TypeScript
import { repository } from "@pkg"
|
|
|
|
import { getCurrentEnvironment } from "./environment"
|
|
|
|
interface IssueOptions {
|
|
title: string
|
|
body: string
|
|
label: string
|
|
}
|
|
export const getNewIssueUrl = ({ body, label, title }: Partial<IssueOptions> = {}) => {
|
|
const baseUrl = `${repository.url}/issues/new`
|
|
|
|
const searchParams = new URLSearchParams()
|
|
|
|
const nextBody = [body || "", "", ...getCurrentEnvironment()].join("\n")
|
|
searchParams.set("body", nextBody)
|
|
if (label) searchParams.set("label", label)
|
|
if (title) searchParams.set("title", title)
|
|
|
|
return `${baseUrl}?${searchParams.toString()}`
|
|
}
|