dockerfile-image-update/src/main/java/com/salesforce/dockerfileimageupdate/utils/GitHubUtil.java
/**
     * Attempt to delete the GitHub repo if there are no pull requests associated with it
     * @param repo the repo to delete
     */
Attempt to delete the GitHub repo if there are no pull requests associated with it
@param repo the repo to delete
Attempt to delete the GitHub repo if there are no pull requests associated with it @param repo the repo to delete
public void safeDeleteRepo(GHRepository repo) throws IOException {
        if (!repo.queryPullRequests().state(GHIssueState.OPEN).list().iterator().hasNext()) {
            try {
                repo.delete();
            } catch (IOException e) {
                throw new IOException("Please verify that the GitHub token " +
                        "provided has access to deleting repositories.");
            }
        } else {
            log.info("Fork has open pull requests. So we will not delete it: {}", repo);
        }
    }
public void safeDeleteRepo ( GHRepository repo ) throws IOException { if ( ! repo . queryPullRequests ( ) . state ( GHIssueState . OPEN ) . list ( ) . iterator ( ) . hasNext ( ) ) { try { repo . delete ( ) ; } catch ( IOException e ) { throw new IOException ( "Please verify that the GitHub token " + "provided has access to deleting repositories." ) ; } } else { log . info ( "Fork has open pull requests. So we will not delete it: {}" , repo ) ; } }
Attempt to delete the GitHub repo if there are no pull requests associated with it
 @param repo the repo to delete
Attempt to delete the GitHub repo if there are no pull requests associated with it @param repo the repo to delete