Repository URL to install this package:
|
Version:
0.0.0-faef1d756148d5 ▾
|
const open = require('open');
const currentBranch = require('current-git-branch');
const chalk = require('chalk');
const { jiraTicketFromBranchName } = require('./jira');
/**
* Attempts to pull the Jira ticket number from the current active branch name,
* and open that ticket number directly in Jira.
*/
module.exports = () => {
const branch = currentBranch();
if (branch) {
const jiraTicket = jiraTicketFromBranchName(branch);
if (jiraTicket) {
const url = `https://doodleag.atlassian.net/browse/${jiraTicket}`;
console.log(`${chalk.cyan('Opening url')} ${url}`);
open(url);
} else {
console.log('No branch starting with a JIRA ticket number was found.');
}
}
};