How to use parse-github-repo-url - 3 common examples

To help you get started, we’ve selected a few parse-github-repo-url examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lo1tuma / pr-log / lib / getGithubRepo.js View on Github external
function getGithubRepo(githubUrl) {
    const result = parseGithubUrl(githubUrl);

    if (!result) {
        throw new Error(`Invalid GitHub URI ${githubUrl}`);
    }

    return `${result[0]}/${result[1]}`;
}
github gedex / wp-tools / src / commands / release-gh.js View on Github external
function getParams( args, config ) {
	const files = config.files || {};
	const mainFile = args.file || files.main;
	const type = args.type || config.type || 'plugin';
	const gh = config.gh || {};
	const repo = args.repo || gh.repo;
	if ( ! repo ) {
		throw new Error( 'Missing GitHub repo. Specify it via --repo or define `gh.repo` in .wpt.yml.' );
	}

	const repoParsed = ghParse( repo );
	if ( ! Array.isArray( repoParsed ) ) {
		throw new Error( 'Invalid gh.repo value, the format is "owner/repo"' );
	}

	const [ repoOwner, repoName, ] = repoParsed;
	const originalBranch = git.getCurrentBranch();
	const branch = args.branch || gh.branch || 'master';
	const token = args.token || process.env.WPT_GITHUB_TOKEN;

	const data = fh.getFileData( mainFile, type );
	const version = data.Version;
	const changelog = readme.getChangelog( version );

	const draft = !! args.draft;
	const preRelease = !! args.preRelease;
github gedex / wp-tools / src / init-input.js View on Github external
ghUser: function( cb ) {
		const gh = ghParse( this.exports.default.ghRepo || '' );
		const d = this.defaults.gh.username || Array.isArray( gh ) ? gh[ 0 ] : undefined;
		const r = this.exports.useDefaults
			? toStr( d )
			: prompt( 'GitHub username', toStr( d ), toStr );

		return cb( null, r );
	},

parse-github-repo-url

Parse a GitHub URL for user/project@version

MIT
Latest version published 7 years ago

Package Health Score

53 / 100
Full package analysis

Popular parse-github-repo-url functions

Similar packages