MCPcopy
hub / github.com/desktop/desktop / createPR

Function createPR

script/pr-api.ts:25–50  ·  view source on GitHub ↗
(
  title: string,
  body: string,
  branch: string
)

Source from the content-addressed store, hash-verified

23}
24
25export function createPR(
26 title: string,
27 body: string,
28 branch: string
29): IAPIPR | null {
30 try {
31 const response = execSync(
32 `gh pr new --repo desktop/desktop --title "${title}" --body "${body}" --head ${branch}`,
33 {
34 encoding: 'utf8',
35 }
36 )
37
38 // The PR url is the last line of the output
39 const url = response.split('\n').pop() ?? ''
40
41 return {
42 title,
43 body,
44 headRefName: branch,
45 url,
46 }
47 } catch (e) {
48 return null
49 }
50}

Callers 1

runFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected