listCheckRunsForRef method

Stream<CheckRun> listCheckRunsForRef(
  1. RepositorySlug slug, {
  2. required String ref,
  3. String? checkName,
  4. CheckRunStatus? status,
  5. CheckRunFilter? filter,
})

Lists check runs for a commit ref. The [ref] can be a SHA, branch name, or a tag name. GitHub Apps must have the checks:read permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the repo scope to get check runs in a private repository.

  • checkName: returns check runs with the specified name.
  • status: returns check runs with the specified status.
  • filter: filters check runs by their completed_at timestamp. Can be one of latest (returning the most recent check runs) or all. Default: latest.

API docs: https://developer.github.com/v3/checks/runs/#list-check-runs-for-a-specific-ref

Implementation

Stream<CheckRun> listCheckRunsForRef(
  RepositorySlug slug, {
  required String ref,
  String? checkName,
  CheckRunStatus? status,
  CheckRunFilter? filter,
}) {
  ArgumentError.checkNotNull(ref);
  return PaginationHelper(github).objects<Map<String, dynamic>, CheckRun>(
    'GET',
    'repos/$slug/commits/$ref/check-runs',
    CheckRun.fromJson,
    statusCode: StatusCodes.OK,
    preview: _previewHeader,
    params: createNonNullMap({
      'check_name': checkName,
      'filter': filter,
      'status': status,
    }),
    arrayKey: 'check_runs',
  );
}