com.jcabi.github.RtGithub Java Examples

The following examples show how to use com.jcabi.github.RtGithub. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReactorConfiguration.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
@Bean
Github githubClient(ReleaserProperties properties) {
	if (!StringUtils.hasText(properties.getGit().getOauthToken())) {
		throw new BeanInitializationException(
				"You must set the value of the OAuth token. You can do it "
						+ "either via the command line [--releaser.git.oauth-token=...] "
						+ "or put it as an env variable in [~/.bashrc] or "
						+ "[~/.zshrc] e.g. [export RELEASER_GIT_OAUTH_TOKEN=...]");
	}
	return new RtGithub(new RtGithub(properties.getGit().getOauthToken()).entry()
			.through(RetryWire.class));
}
 
Example #2
Source File: GithubConfiguration.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
@Bean
BeanPostProcessor cachingGithubBeanPostProcessor() {
	return new BeanPostProcessor() {
		@Override
		public Object postProcessAfterInitialization(Object bean, String beanName)
				throws BeansException {
			if (bean instanceof RtGithub) {
				return new CachingGithub((Github) bean);
			}
			return bean;
		}
	};
}
 
Example #3
Source File: SpringCloudInfoApplication.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
@Bean
public SpringCloudInfoService initializrSpringCloudVersionService(
		SpringCloudInfoConfigurationProperties properties) {
	Github github = new RtGithub(properties.getGit().getOauthToken());
	RestTemplate rest = new RestTemplateBuilder().build();
	return new InitializrSpringCloudInfoService(rest, github,
			new GithubPomReader(new MavenXpp3Reader(), rest));
}
 
Example #4
Source File: NotificationsResource.java    From charles-rest with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Handles notifications, starts one action thread for each of them.
 * @param notifications List of notifications.
 * @return true if actions were started successfully; false otherwise.
 */
private boolean handleNotifications(final Notifications notifications) {
    String authToken = System.getProperty("github.auth.token");
    if(authToken == null || authToken.isEmpty()) {
        LOG.error("Missing github.auth.token. Please specify a Github api access token!");
        return false;
    } else {
        Github gh = new RtGithub(
            new RtGithub(
                authToken
            ).entry().through(RetryWire.class)
        );
        try {
            for(final Notification notification : notifications) {
                this.actions.take(
                    new Action(
                        gh.repos().get(
                            new Coordinates.Simple(notification.repoFullName())
                        ).issues().get(notification.issueNumber())
                    )
                );
            }
            return true;
        } catch (IOException ex) {
            LOG.error("IOException while getting the Issue from Github API");
            return false;
        }
    }
}
 
Example #5
Source File: GithubFacadeBuilder.java    From sputnik with Apache License 2.0 5 votes vote down vote up
@NotNull
public GithubFacade build(Configuration configuration) {

    Patchset patchset = PatchsetBuilder.build(configuration);

    String oAuthKey = configuration.getProperty(GeneralOption.GITHUB_API_KEY);
    Github github = new RtGithub(
            new RtGithub(oAuthKey)
                    .entry()
                    .through(RetryWire.class)
    );

    Repo repo = github.repos().get(new Coordinates.Simple(patchset.getProjectPath()));
    return new GithubFacade(repo, patchset);
}
 
Example #6
Source File: GithubIssueFiler.java    From spring-cloud-release-tools with Apache License 2.0 4 votes vote down vote up
public GithubIssueFiler(ReleaserProperties properties) {
	this(new RtGithub(new RtGithub(properties.getGit().getOauthToken()).entry()
			.through(RetryWire.class)), properties);
}
 
Example #7
Source File: GithubMilestones.java    From spring-cloud-release-tools with Apache License 2.0 4 votes vote down vote up
GithubMilestones(ReleaserProperties properties) {
	this(new RtGithub(new RtGithub(properties.getGit().getOauthToken()).entry()
			.through(RetryWire.class)), properties);
}