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-pr.js
Size: Mime:
const gitRemoteOriginUrl = require('git-remote-origin-url');
const currentBranch = require('current-git-branch');
const open = require('open');

module.exports = async () => {
  let remote;

  try {
    remote = await gitRemoteOriginUrl();
  } catch (err) {
    console.log(`Could not read remote origin: ${err}`);
  }

  const branch = currentBranch();

  const projectName = remote.split('git@github.com:')[1].replace(/\.git$/, '');

  let url = `https://github.com/${projectName}/pulls?q=head%3A${branch}`;

  if (branch === 'master') {
    url = `https://github.com/${projectName}`;
  }

  open(url);
};