Skip to content

Commit

Permalink
Added all possible status values from GH api spec. (#1885)
Browse files Browse the repository at this point in the history
* Added all possible status values from GH api spec.

Added all possible github workflow run status values specified in
https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28

* Add touch enum tests

---------

Co-authored-by: Liam Newman <[email protected]>
  • Loading branch information
mpetris and bitwiseman authored Jul 1, 2024
1 parent 29cdf34 commit 895ddce
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 4 deletions.
22 changes: 22 additions & 0 deletions src/main/java/org/kohsuke/github/GHWorkflowRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,28 @@ public static enum Status {
IN_PROGRESS,
/** The completed. */
COMPLETED,
/** The action required. */
ACTION_REQUIRED,
/** The cancelled. */
CANCELLED,
/** The failure. */
FAILURE,
/** The neutral. */
NEUTRAL,
/** The skipped. */
SKIPPED,
/** The stale. */
STALE,
/** The success. */
SUCCESS,
/** The timed out. */
TIMED_OUT,
/** The requested. */
REQUESTED,
/** The waiting. */
WAITING,
/** The pending. */
PENDING,
/** The unknown. */
UNKNOWN;

Expand Down
40 changes: 36 additions & 4 deletions src/test/java/org/kohsuke/github/EnumTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.kohsuke.github;

import org.junit.Test;
import org.kohsuke.github.GHPullRequest.MergeMethod;
import org.kohsuke.github.internal.Previews;

import static org.hamcrest.CoreMatchers.*;
Expand Down Expand Up @@ -29,10 +28,14 @@ public void touchEnums() {

assertThat(GHCommentAuthorAssociation.values().length, equalTo(8));

assertThat(GHCommitSearchBuilder.Sort.values().length, equalTo(2));

assertThat(GHCommitState.values().length, equalTo(4));

assertThat(GHCompare.Status.values().length, equalTo(4));

assertThat(GHContentSearchBuilder.Sort.values().length, equalTo(2));

assertThat(GHDeploymentState.values().length, equalTo(7));

assertThat(GHDirection.values().length, equalTo(2));
Expand All @@ -41,10 +44,17 @@ public void touchEnums() {
assertThat(GHEvent.ALL.symbol(), equalTo("*"));
assertThat(GHEvent.PULL_REQUEST.symbol(), equalTo(GHEvent.PULL_REQUEST.toString().toLowerCase()));

assertThat(GHFork.values().length, equalTo(3));
assertThat(GHFork.PARENT_ONLY.toString(), equalTo(""));

assertThat(GHIssueQueryBuilder.Sort.values().length, equalTo(3));

assertThat(GHIssueSearchBuilder.Sort.values().length, equalTo(3));

assertThat(GHIssueState.values().length, equalTo(3));

assertThat(GHIssueStateReason.values().length, equalTo(3));

assertThat(GHMarketplaceAccountType.values().length, equalTo(2));

assertThat(GHMarketplaceListAccountBuilder.Sort.values().length, equalTo(2));
Expand All @@ -65,10 +75,16 @@ public void touchEnums() {
assertThat(GHProject.ProjectState.values().length, equalTo(2));
assertThat(GHProject.ProjectStateFilter.values().length, equalTo(3));

assertThat(MergeMethod.values().length, equalTo(3));
assertThat(GHProjectsV2Item.ContentType.values().length, equalTo(4));

assertThat(GHProjectsV2ItemChanges.FieldType.values().length, equalTo(6));

assertThat(GHPullRequest.MergeMethod.values().length, equalTo(3));

assertThat(GHPullRequestQueryBuilder.Sort.values().length, equalTo(4));

assertThat(GHPullRequestReviewComment.Side.values().length, equalTo(3));

assertThat(GHPullRequestReviewEvent.values().length, equalTo(4));
assertThat(GHPullRequestReviewEvent.PENDING.toState(), equalTo(GHPullRequestReviewState.PENDING));
assertThat(GHPullRequestReviewEvent.PENDING.action(), nullValue());
Expand All @@ -78,20 +94,36 @@ public void touchEnums() {
assertThat(GHPullRequestReviewState.APPROVED.action(), equalTo(GHPullRequestReviewEvent.APPROVE.action()));
assertThat(GHPullRequestReviewState.DISMISSED.toEvent(), nullValue());

assertThat(GHPullRequestSearchBuilder.Sort.values().length, equalTo(4));

assertThat(GHReleaseBuilder.MakeLatest.values().length, equalTo(3));

assertThat(GHRepository.CollaboratorAffiliation.values().length, equalTo(3));
assertThat(GHRepository.ForkSort.values().length, equalTo(3));
assertThat(GHRepository.Visibility.values().length, equalTo(4));

assertThat(GHRepositoryDiscussion.State.values().length, equalTo(3));

assertThat(GHRepositorySearchBuilder.Sort.values().length, equalTo(3));
assertThat(GHRepositorySearchBuilder.Fork.values().length, equalTo(3));
assertThat(GHRepositorySearchBuilder.Fork.PARENT_ONLY.toString(), equalTo(""));

assertThat(GHRepositorySelection.values().length, equalTo(2));

assertThat(GHTargetType.values().length, equalTo(2));

assertThat(GHTeam.Role.values().length, equalTo(2));
assertThat(GHTeam.Privacy.values().length, equalTo(3));

assertThat(GHUserSearchBuilder.Sort.values().length, equalTo(3));

assertThat(GHIssueQueryBuilder.Sort.values().length, equalTo(3));
}
assertThat(GHVerification.Reason.values().length, equalTo(18));

assertThat(GHWorkflowRun.Status.values().length, equalTo(15));
assertThat(GHWorkflowRun.Conclusion.values().length, equalTo(10));

assertThat(MarkdownMode.values().length, equalTo(2));

assertThat(ReactionContent.values().length, equalTo(8));
}
}

0 comments on commit 895ddce

Please sign in to comment.