public void check() {

        if (!trigger.isActive()) {
            LOGGER.log(Level.FINE, "Project is not active, not checking github state");
            return;
        }

        if (!initGhRepository()) {
            return;
        }

        GHRepository repo = getGitHubRepo();

        List<GHPullRequest> openPulls;
        try {
            openPulls = repo.getPullRequests(GHIssueState.OPEN);
        } catch (IOException ex) {
            LOGGER.log(Level.SEVERE, "Could not retrieve open pull requests.", ex);
            return;
        }


        Set<Integer> closedPulls = new HashSet<Integer>(pullRequests.keySet());

        for (GHPullRequest pr : openPulls) {
            if (pr.getHead() == null) { // Not sure if we need this, but leaving it for now.
                try {
                    pr = getActualPullRequest(pr.getNumber());
                } catch (IOException ex) {
                    LOGGER.log(Level.SEVERE, "Could not retrieve pr " + pr.getNumber(), ex);
                    return;
                }
            }
            check(pr);
            closedPulls.remove(pr.getNumber());
        }


        // remove closed pulls so we don't check them again
        for (Integer id : closedPulls) {
            pullRequests.remove(id);
        }
        try {
            this.save();
        } catch (IOException e) {
            LOGGER.log(Level.SEVERE, "Unable to save repository!", e);
        }
    }
public void check ( ) { if ( ! trigger . isActive ( ) ) { LOGGER . log ( Level . FINE , "Project is not active, not checking github state" ) ; return ; } if ( ! initGhRepository ( ) ) { return ; } GHRepository repo = getGitHubRepo ( ) ; List < GHPullRequest > openPulls ; try { openPulls = repo . getPullRequests ( GHIssueState . OPEN ) ; } catch ( IOException ex ) { LOGGER . log ( Level . SEVERE , "Could not retrieve open pull requests." , ex ) ; return ; } Set < Integer > closedPulls = new HashSet < Integer > ( pullRequests . keySet ( ) ) ; for ( GHPullRequest pr : openPulls ) { if ( pr . getHead ( ) == null ) { try { pr = getActualPullRequest ( pr . getNumber ( ) ) ; } catch ( IOException ex ) { LOGGER . log ( Level . SEVERE , "Could not retrieve pr " + pr . getNumber ( ) , ex ) ; return ; } } check ( pr ) ; closedPulls . remove ( pr . getNumber ( ) ) ; } for ( Integer id : closedPulls ) { pullRequests . remove ( id ) ; } try { this . save ( ) ; } catch ( IOException e ) { LOGGER . log ( Level . SEVERE , "Unable to save repository!" , e ) ; } }
comments/hashes that have been added since the last time we checked.