Default to pull_request events (#54640)

This commit is contained in:
Dimitris Sotirakis 2022-09-02 17:39:05 +03:00 committed by GitHub
parent 28426219ce
commit 8be3ea269d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -141,6 +141,7 @@ func GetGrafanaVersion(buildID, grafanaDir string) (string, error) {
func CheckDroneTargetBranch() (VersionMode, error) {
reRlsBranch := regexp.MustCompile(`^v\d+\.\d+\.x$`)
rePRCheckBranch := regexp.MustCompile(`^pr-check-\d+`)
target := os.Getenv("DRONE_TARGET_BRANCH")
if target == "" {
return "", fmt.Errorf("failed to get DRONE_TARGET_BRANCH environmental variable")
@ -150,7 +151,11 @@ func CheckDroneTargetBranch() (VersionMode, error) {
if reRlsBranch.MatchString(target) {
return ReleaseBranchMode, nil
}
return "", fmt.Errorf("unrecognized target branch: %s", target)
if rePRCheckBranch.MatchString(target) {
return PullRequestMode, nil
}
fmt.Printf("unrecognized target branch: %s, defaulting to %s", target, PullRequestMode)
return PullRequestMode, nil
}
func CheckSemverSuffix() (ReleaseMode, error) {