Java Code Examples for org.kohsuke.github.GHCommitState#PENDING

The following examples show how to use org.kohsuke.github.GHCommitState#PENDING . 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: GitHubNotificationContext.java    From github-branch-source-plugin with MIT License 6 votes vote down vote up
/**
 * Retrieves default notification state
 * @param listener Listener for the build, if any
 * @return Default notification state
 * @since 2.3.2
 */
public GHCommitState getDefaultState(TaskListener listener) {
    if (null != build && !build.isBuilding()) {
        Result result = build.getResult();
        if (Result.SUCCESS.equals(result)) {
            return GHCommitState.SUCCESS;
        } else if (Result.UNSTABLE.equals(result)) {
            return GHCommitState.FAILURE;
        } else if (Result.FAILURE.equals(result)) {
            return GHCommitState.ERROR;
        } else if (Result.ABORTED.equals(result)) {
            return GHCommitState.ERROR;
        } else if (result != null) { // NOT_BUILT etc.
            return GHCommitState.ERROR;
        }
    }
    return GHCommitState.PENDING;
}
 
Example 2
Source File: GitHubProvider.java    From gocd-build-status-notifier with Apache License 2.0 5 votes vote down vote up
GHCommitState getState(String result) {
    result = result == null ? "" : result;
    GHCommitState state = GHCommitState.PENDING;
    if (result.equalsIgnoreCase("Passed")) {
        state = GHCommitState.SUCCESS;
    } else if (result.equalsIgnoreCase("Failed")) {
        state = GHCommitState.FAILURE;
    } else if (result.equalsIgnoreCase("Cancelled")) {
        state = GHCommitState.ERROR;
    }
    return state;
}