Search in sources :

Example 1 with Comment

use of com.atlassian.stash.comment.Comment in project stashbot by palantir.

the class PullRequestListener method listenForComments.

@EventListener
public void listenForComments(PullRequestCommentEvent event) {
    try {
        final PullRequest pr = event.getPullRequest();
        final Repository repo = pr.getToRef().getRepository();
        final RepositoryConfiguration rc = cpm.getRepositoryConfigurationForRepository(repo);
        if (!rc.getCiEnabled()) {
            log.debug("Pull Request " + pr.toString() + " ignored, CI not enabled for target repo " + repo.toString());
            return;
        }
        Comment c = event.getComment();
        if (c.getText().contains(OVERRIDE_STRING)) {
            log.debug("Pull Request override set to true for PR " + pr.toString());
            cpm.setPullRequestMetadata(pr, null, null, true);
        }
    } catch (SQLException e) {
        log.error("Error getting repository configuration", e);
    }
}
Also used : Comment(com.atlassian.stash.comment.Comment) Repository(com.atlassian.stash.repository.Repository) SQLException(java.sql.SQLException) PullRequest(com.atlassian.stash.pull.PullRequest) RepositoryConfiguration(com.palantir.stash.stashbot.persistence.RepositoryConfiguration) EventListener(com.atlassian.event.api.EventListener)

Aggregations

EventListener (com.atlassian.event.api.EventListener)1 Comment (com.atlassian.stash.comment.Comment)1 PullRequest (com.atlassian.stash.pull.PullRequest)1 Repository (com.atlassian.stash.repository.Repository)1 RepositoryConfiguration (com.palantir.stash.stashbot.persistence.RepositoryConfiguration)1 SQLException (java.sql.SQLException)1