Skip to content

Instantly share code, notes, and snippets.

@peterneave
Last active March 1, 2022 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterneave/c998b885ffc9299e02a5ca1e834b9b15 to your computer and use it in GitHub Desktop.
Save peterneave/c998b885ffc9299e02a5ca1e834b9b15 to your computer and use it in GitHub Desktop.
Go to Jira from Source Tree
#Script to Run: C:\Program Files\PowerShell\7\pwsh.exe
#param: c:\dev\GoToJira.ps1 $REPO $SHA
Param(
[string]$REPO,
[string]$SHA
)
pushd $REPO
$var = (git log -n 1 --pretty=medium $SHA) | Out-String
popd
$regex = '((?<!([A-Za-z]{1,10})-?)[A-Z]+-\d+)'
$var -match $regex | Out-Null
$ticket = $Matches[0]
$url = "https://insertyourteamhere.atlassian.net/browse/$ticket"
#& "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" $url
& "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" $url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment