io.dangernoodle.grt.extensions.DefaultStatusCheckFactory Maven / Gradle / Ivy
package io.dangernoodle.grt.extensions;
import java.util.Collection;
import java.util.Collections;
import java.util.Optional;
import io.dangernoodle.grt.Repository;
/**
* Default status check factory.
*
* Returns the contexts field from the protections section of the repository definition for
* the given branch.
*
*
* @since 0.1.0
*/
public class DefaultStatusCheckFactory implements StatusCheckFactory
{
@Override
public Collection getRequiredStatusChecks(String branch, Repository repository)
{
return Optional.ofNullable(repository.getSettings()
.getBranches()
.getProtection(branch)
.getRequiredChecks()
.getContexts())
.orElse(Collections.emptyList());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy