Skip to content

Commit ee09afb

Browse files
garymoonLoïc Dachary
authored and
Loïc Dachary
committed
Skip GitHub migration tests if the API token is undefined (go-gitea#21824)
GitHub migration tests will be skipped if the secret for the GitHub API token hasn't been set. This change should make all tests pass (or skip in the case of this one) for anyone running the pipeline on their own infrastructure without further action on their part. Resolves go-gitea#21739 Signed-off-by: Gary Moon <[email protected]> (cherry picked from commit af149bd91f5b042ba108aa972eba832c0ce085b1)
1 parent 4c7786b commit ee09afb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

services/migrations/github_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ import (
1818

1919
func TestGitHubDownloadRepo(t *testing.T) {
2020
GithubLimitRateRemaining = 3 // Wait at 3 remaining since we could have 3 CI in //
21-
downloader := NewGithubDownloaderV3(context.Background(), "https://github.com", "", "", os.Getenv("GITHUB_READ_TOKEN"), "go-gitea", "test_repo")
21+
token := os.Getenv("GITHUB_READ_TOKEN")
22+
if token == "" {
23+
t.Skip("Skipping GitHub migration test because GITHUB_READ_TOKEN is empty")
24+
}
25+
downloader := NewGithubDownloaderV3(context.Background(), "https://github.com", "", "", token, "go-gitea", "test_repo")
2226
err := downloader.RefreshRate()
2327
assert.NoError(t, err)
2428

0 commit comments

Comments
 (0)