Skip to content

Commit

Permalink
KTB-15: improve pr creation link (#10)
Browse files Browse the repository at this point in the history
* lint

* handle rebase errors
  • Loading branch information
a7madgamal authored Mar 27, 2020
1 parent a867664 commit 8d0993a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
18 changes: 13 additions & 5 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,19 @@ ipcMain.on(
)

ipcMain.on(IPC_REBASE_BRANCH, async (e, repoId, branchName) => {
await rebaseLocalBranch(repoId, branchName)
showNotification({
title: 'branch rebased',
body: `${repoId}:${branchName}`,
})
try {
await rebaseLocalBranch(repoId, branchName)
showNotification({
title: 'branch rebased',
body: `${repoId}:${branchName}`,
})
} catch (error) {
showNotification({
title: 'branch rebase failed, fix the conflict',
body: `${repoId}:${branchName}`,
})
}

mainWindow.webContents.send(IPC_REFRESH_GIT)
})

Expand Down
3 changes: 2 additions & 1 deletion src/plugins/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ const generateNewOrCurrentPRLink = ({
const ticketID = `${branchNameArray
.shift()
?.toUpperCase()}-${branchNameArray.shift()}`

const state = store.getState()

const hasPR =
Expand All @@ -140,7 +141,7 @@ const generateNewOrCurrentPRLink = ({
if (hasPR) {
return hasPR.html_url
} else {
return `https://github.com/${orgID}/${repoId}/compare/${branchName}?expand=1&title=${ticketID} - ${branchNameArray.join(
return `https://github.com/${orgID}/${repoId}/compare/${branchName}?expand=1&title=${ticketID}: ${branchNameArray.join(
' ',
)}`
}
Expand Down

0 comments on commit 8d0993a

Please sign in to comment.