Skip to content

Commit 521e8a9

Browse files
authored
Merge pull request #2 from silverwind/giteaactions
Add support for Gitea Actions
2 parents 198795b + a9cd1b6 commit 521e8a9

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

supportscolor.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,15 @@ func supportsColor(config *configuration) ColorLevel {
210210
}
211211

212212
if _, ci := env.LookupEnv("CI"); ci {
213-
var ciEnvNames = []string{"TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE", "DRONE"}
213+
var trueColorEnvNames = []string{"GITHUB_ACTIONS", "GITEA_ACTIONS"}
214+
for _, trueColorEnvName := range trueColorEnvNames {
215+
_, exists := env.LookupEnv(trueColorEnvName)
216+
if exists {
217+
return Ansi16m
218+
}
219+
}
220+
221+
var ciEnvNames = []string{"TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"}
214222
for _, ciEnvName := range ciEnvNames {
215223
_, exists := env.LookupEnv(ciEnvName)
216224
if exists {

supportscolor_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,18 @@ func TestReturnBasicIfTravis(t *testing.T) {
291291
}
292292
}
293293

294+
func TestReturnTrueColorIfActions(t *testing.T) {
295+
for _, ci := range []string{"GITHUB_ACTIONS", "GITEA_ACTIONS"} {
296+
result := SupportsColor(0, setEnvironment(&testEnvironment{
297+
env: map[string]string{"CI": "true", ci: "true"},
298+
}))
299+
300+
if result.Level != Ansi16m {
301+
t.Errorf("%v: Expected %v, got %v", ci, Ansi16m, result.Level)
302+
}
303+
}
304+
}
305+
294306
func TestReturnBasicIfCI(t *testing.T) {
295307
for _, ci := range []string{"CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"} {
296308
result := SupportsColor(0, setEnvironment(&testEnvironment{

0 commit comments

Comments
 (0)