forked from camerb/AHKs
-
Notifications
You must be signed in to change notification settings - Fork 38
/
GitPushAndCloseBranch.ahk
33 lines (24 loc) · 1.23 KB
/
GitPushAndCloseBranch.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include FcnLib.ahk
#include FcnLib-Misc.ahk
#include ThirdParty/CmdRet.ahk
currentBranchName := GitGetCurrentBranchName()
if InStr(currentBranchName, "pushed")
fatalErrord("", currentBranchName, "This branch has already been pushed to origin")
if NOT RegExMatch(currentBranchName, "(EPMS|FLB|SM|LXS|LYNX)")
fatalErrord("", currentBranchName, "It looks like this branch is not part of a recognized project")
ForceWinFocus("MINGW32", "Contains")
Send, git status{ENTER}
Send, git push origin %currentBranchName%{ENTER}
Send, git branch -m %currentBranchName% pushed/%currentBranchName%{ENTER}
message=The branch origin/%currentBranchName% is ready to move live`n`n
RegExMatch(currentBranchName, "(\w+-\d+)", match)
issueNumber := match1
command=perl C:\code\mtsi-scripts\jira-issue-title.pl %issueNumber%
issueTitle := CmdRet_RunReturn( command )
message .= issueTitle
subject = Branch to merge [%currentBranchName%]
;debug(message)
if InStr(message, "exception")
message := Prompt("The message that will be sent to Nathan is as follows, it looks like it contains an exception, so please revise it:`n`n" . message)
SleepSeconds(15)
;SendEmail(subject, message, "", "nathan@mitsi.com", "cameronbaustian@gmail.com")