Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: update github ref used on e2e oncluster tests #1917

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions test/oncluster/scenario_github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package oncluster

import (
"path/filepath"
"regexp"
"strings"
"testing"

Expand Down Expand Up @@ -32,10 +33,14 @@ Notes:

func resolveGitVars() (gitRepoUrl string, gitRef string) {
// 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")
gitRef = common.GetOsEnvOrDefault("GITHUB_REF", "main")
gitRepoUrl = "https://github.com/" + gitRepo + ".git"

gitRef = common.GetOsEnvOrDefault("GITHUB_REF", "main")
matejvasek marked this conversation as resolved.
Show resolved Hide resolved
// 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
}

Expand Down
Loading