getGithubRepo function

Future<String?> getGithubRepo({
  1. String? cwd,
})

Get the GitHub repo in "owner/repo" format.

Implementation

Future<String?> getGithubRepo({String? cwd}) async {
  final remoteUrl = await getRemoteUrl(cwd: cwd);
  if (remoteUrl == null) return null;
  final parsed = parseGitRemote(remoteUrl);
  if (parsed != null && parsed.host == 'github.com') {
    return '${parsed.owner}/${parsed.name}';
  }
  return null;
}