mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-10 08:21:21 +00:00
Be more permissive about GHEvent parsing
This commit is contained in:
@@ -67,6 +67,11 @@ public enum GHEvent {
|
||||
WORKFLOW_DISPATCH,
|
||||
WORKFLOW_RUN,
|
||||
|
||||
/**
|
||||
* Special event type that means we haven't found an enum value corresponding to the event.
|
||||
*/
|
||||
UNKNOWN,
|
||||
|
||||
/**
|
||||
* Special event type that means "every possible event"
|
||||
*/
|
||||
|
||||
@@ -188,7 +188,7 @@ public class GHWorkflowRun extends GHObject {
|
||||
* @return type of event
|
||||
*/
|
||||
public GHEvent getEvent() {
|
||||
return Enum.valueOf(GHEvent.class, event.toUpperCase(Locale.ROOT));
|
||||
return EnumUtils.getNullableEnumOrDefault(GHEvent.class, event, GHEvent.UNKNOWN);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@ public class EnumTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
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()));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user