repo property

RepoInfo get repo

Gets the information about the repository.

Implementation

RepoInfo get repo {
  if (env.containsKey('GITHUB_REPOSITORY')) {
    final repoParts = env['GITHUB_REPOSITORY']!.split('/');
    return RepoInfo(owner: repoParts[0], repo: repoParts[1]);
  }

  if (payload.repository != null) {
    return RepoInfo(
      owner: payload.repository!['owner']['login']!,
      repo: payload.repository!['name']!,
    );
  }

  throw Exception(
      "context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'");
}