Skip to content

Commit

Permalink
Be more permissive about GHEvent parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed Apr 14, 2021
1 parent 696dd90 commit b0216a8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/java/org/kohsuke/github/GHEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public enum GHEvent {
WATCH,
WORKFLOW_DISPATCH,
WORKFLOW_RUN,
UNKNOWN,

/**
* Special event type that means "every possible event"
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/kohsuke/github/GHWorkflowRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public GHRepository getHeadRepository() {
* @return type of event
*/
public GHEvent getEvent() {
return Enum.valueOf(GHEvent.class, event.toUpperCase(Locale.ROOT));
return EnumUtils.getNullableEnumOrDefault(GHEvent.class, event, GHEvent.UNKNOWN);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/kohsuke/github/EnumTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void touchEnums() {

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

assertThat(GHEvent.values().length, equalTo(57));
assertThat(GHEvent.values().length, equalTo(58));
assertThat(GHEvent.ALL.symbol(), equalTo("*"));
assertThat(GHEvent.PULL_REQUEST.symbol(), equalTo(GHEvent.PULL_REQUEST.toString().toLowerCase()));

Expand Down

0 comments on commit b0216a8

Please sign in to comment.