From 895ddce4e18e4ab6f650e24f33ff13adabd9c025 Mon Sep 17 00:00:00 2001 From: mpetris Date: Mon, 1 Jul 2024 20:25:03 +0200 Subject: [PATCH] Added all possible status values from GH api spec. (#1885) * 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 --- .../org/kohsuke/github/GHWorkflowRun.java | 22 ++++++++++ .../java/org/kohsuke/github/EnumTest.java | 40 +++++++++++++++++-- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/kohsuke/github/GHWorkflowRun.java b/src/main/java/org/kohsuke/github/GHWorkflowRun.java index c2e38ce507..b12e8f005e 100644 --- a/src/main/java/org/kohsuke/github/GHWorkflowRun.java +++ b/src/main/java/org/kohsuke/github/GHWorkflowRun.java @@ -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; diff --git a/src/test/java/org/kohsuke/github/EnumTest.java b/src/test/java/org/kohsuke/github/EnumTest.java index 7122bd3291..02ab6d912d 100644 --- a/src/test/java/org/kohsuke/github/EnumTest.java +++ b/src/test/java/org/kohsuke/github/EnumTest.java @@ -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.*; @@ -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)); @@ -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)); @@ -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()); @@ -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)); + } }