mirror of https://github.com/knative/func.git
test: update github ref used on e2e oncluster tests (#1917)
This commit is contained in:
parent
89cf6b7a06
commit
399ab7dd17
|
@ -4,6 +4,7 @@ package oncluster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -32,10 +33,14 @@ Notes:
|
||||||
|
|
||||||
func resolveGitVars() (gitRepoUrl string, gitRef string) {
|
func resolveGitVars() (gitRepoUrl string, gitRef string) {
|
||||||
// On a GitHub Action (Pull Request) these variables will be set
|
// On a GitHub Action (Pull Request) these variables will be set
|
||||||
// https://docs.github.com/en/actions/learn-github-actions/variables
|
// https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
|
||||||
gitRepo := common.GetOsEnvOrDefault("GITHUB_REPOSITORY", "knative/func")
|
gitRepo := common.GetOsEnvOrDefault("GITHUB_REPOSITORY", "knative/func")
|
||||||
gitRef = common.GetOsEnvOrDefault("GITHUB_REF", "main")
|
|
||||||
gitRepoUrl = "https://github.com/" + gitRepo + ".git"
|
gitRepoUrl = "https://github.com/" + gitRepo + ".git"
|
||||||
|
|
||||||
|
gitRef = common.GetOsEnvOrDefault("GITHUB_REF", "main")
|
||||||
|
// GitHub uses 2 refs per merge request (refs/pull/ID/head and refs/pull/ID/merge), ensure using */head
|
||||||
|
exp := regexp.MustCompile("^refs/pull/(.*?)/merge$")
|
||||||
|
gitRef = exp.ReplaceAllString(gitRef, "refs/pull/${1}/head")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue