Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@doodle/doodle-node-cli / src / utils / open-jira.js
Size: Mime:
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.');
    }
  }
};