package trigger

import (
	"github.com/juju/errors"
	"strings"
)

func getBranchFromValue(value string) (string, string, error) {
	gitValues := strings.Split(value, ":")
	if len(gitValues) != 3 {
		return "", "", errors.NotValidf("%s", value)
	}
	if gitValues[1] != "branch" {
		return "", "", errors.NotValidf("%s not contains branch", value)
	}
	return gitValues[0], gitValues[2], nil
}
