Function
createPR
(
title: string,
body: string,
branch: string
)
Source from the content-addressed store, hash-verified
| 23 | } |
| 24 | |
| 25 | export 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 | } |
Tested by
no test coverage detected