Awesome
GitHub List Repositories Resource
Lists the repositories that belong to a GitHub organization or team, but does not clone them.
This resource was implemented to trigger the reconfiguration and deployment of a Concourse CI pipeline which has jobs per repository (and therefore does not need to clone any of the repositories in order to build the pipeline).
Internally uses the GitHub v4 API (GraphQL).
Source Configuration
auth_token
: Required (string
). A GitHub API auth token. This auth token must haverepo
scope, and if the resource queries the repositories belonging to a team, it must also haveread:org
scope for the organization to which the team belongs.org
: Required (string
). The organization whose repositories should be listed.team
: Optional (string
). The team whose repositories should be listed.v4_endpoint
: Optional (string
). The graphql endpoint for the git repository. Defaults to ``"https://api.github.com/graphql"`.exclude_regex
: Optional (string
). A regular expression of repositories which should not be included in the final list. May not be specified wheninclude_regex
is specified.exclude
: Optional (array[string]
). A list of repositories which should not be included in the final list. This list is appended to theexclude_regex
to build a final exclusionary rule, and bothexclude
andexclude_regex
may be specified. May not be specified wheninclude_regex
is specified.include_regex
: Optional (string
). A regular expression of repository names which should be included in the final list (repositories which do not match the regex will not be included). May not be specified when eitherexclude_regex
orexclude
are specified.include_archived
: Optional (bool
). Include archived repositories in the list of repositories. Defaults totrue
. When set tofalse
, archived repositories will not be included in the final repository list.
Example Usage
Resource type definition
resource_types:
- name: github-list-repos
type: docker-image
source:
repository: quay.io/coralogix/concourse-resource-github-list-repos
tag: v0.5.0
Resource configuration with exclusions
resources:
- name: repo-list
type: github-list-repos
source:
auth_token: ((managed-auth-token))
org: myorg
team: myteam
exclude_regex: "internal-helper|utility"
exclude:
- irrelevant
- legacy-service
Resource configuration with an inclusion regex
resources:
- name: repo-list
type: github-list-repos
source:
auth_token: ((managed-auth-token))
org: myorg
team: myteam
include_regex: "^myprefix-"
Behavior
check
: Check for a change in the repository list
The GitHub API is queried for a list of all of the repositories belonging to the org
or the team
. This list is sorted and hashed, so that subsequent calls will result in the same hash if no repositories have been added or deleted. This hash is returned as the version.
in
: Fetch a list of repositories
The GitHub API is queried for a list of all of the repositories belonging to the org
or the team
. This list is output to a file called repository-list.<ext>
where <ext>
is defined by the output_format
.
Params
output_format
: Optional (string
). Specifies which format the list should be in. The options aretxt
(newline separated text file output torepository-list.txt
) andjson
(a JSON array output torepository-list.json
).txt
is the default.
out
: Not supported
Maintainers
License
Apache License 2.0 © Coralogix, Inc.