Interface GitHubConfigFileProvider
- All Known Implementing Classes:
GitHubConfigFileProviderImpl
GitHub repositories.
Inject as a CDI bean.
NOTE: You generally will not need this bean when processing events,
as configuration files can be automatically injected into event listener methods,
simply by annotating a parameter with ConfigFile.
This provider is mostly useful for non-event use cases (e.g. cron jobs).
- See Also:
-
Method Summary
Modifier and TypeMethodDescription<T> Optional<T>fetchConfigFile(org.kohsuke.github.GHRepository repository, String path, ConfigFile.Source source, Class<T> type) Fetches the configuration file at the given path from the main branch of the given repository, optionally (iftypeis not justString) deserializing it to the given type using Jackson.<T> Optional<T>fetchConfigFile(org.kohsuke.github.GHRepository repository, String ref, String path, ConfigFile.Source source, Class<T> type) Fetches the configuration file at the given path from the given ref of the given repository, optionally (iftypeis not justString) deserializing it to the given type using Jackson.
-
Method Details
-
fetchConfigFile
<T> Optional<T> fetchConfigFile(org.kohsuke.github.GHRepository repository, String path, ConfigFile.Source source, Class<T> type) Fetches the configuration file at the given path from the main branch of the given repository, optionally (iftypeis not justString) deserializing it to the given type using Jackson.NOTE: You generally will not need this method when processing events, as configuration files can be automatically injected into event listener methods, simply by annotating a parameter with
ConfigFile. This provider is mostly useful for non-event use cases (e.g. cron jobs).- Parameters:
repository- The GitHub code repository to retrieve the file from.path- The path to the file in the code repository, either absolute (if it starts with/) or relative to/.github/(if it doesn't start with/).source- Which repository to extract the file from in the case of forked repositories.type- The type to deserialize the file to.- Returns:
- The configuration file wrapped in an
Optional, orOptional.empty()if it is missing. - Throws:
IllegalStateException- If the configuration file cannot be deserialized to the given type.- See Also:
-
fetchConfigFile
<T> Optional<T> fetchConfigFile(org.kohsuke.github.GHRepository repository, String ref, String path, ConfigFile.Source source, Class<T> type) Fetches the configuration file at the given path from the given ref of the given repository, optionally (iftypeis not justString) deserializing it to the given type using Jackson.NOTE: You generally will not need this method when processing events, as configuration files can be automatically injected into event listener methods, simply by annotating a parameter with
ConfigFile. This provider is mostly useful for non-event use cases (e.g. cron jobs).- Parameters:
repository- The GitHub code repository to retrieve the file from.ref- The git ref (branch, commit SHA, ...) to retrieve the file from.path- The path to the file in the code repository, either absolute (if it starts with/) or relative to/.github/(if it doesn't start with/).source- Which repository to extract the file from in the case of forked repositories.type- The type to deserialize the file to.- Returns:
- The configuration file wrapped in an
Optional, orOptional.empty()if it is missing. - Throws:
IllegalStateException- If the configuration file cannot be deserialized to the given type.- See Also:
-