Skip to content

Commit 9287e21

Browse files
Disable coverage on GHE
1 parent 61f33b0 commit 9287e21

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

internal/ghworkflow/workflow_ci.go

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,24 +66,27 @@ func ciWorkflow(cfg core.Configuration, sr golang.ScanResult) {
6666

6767
w.Jobs["test"] = testJob
6868

69-
// see https://github.com/fgrosse/go-coverage-report#usage
70-
codeCov := baseJob("Code coverage report", cfg.GitHubWorkflow)
71-
codeCov.If = "github.event_name == 'pull_request'"
72-
codeCov.Needs = []string{"test"}
73-
codeCov.Permissions = permissions{
74-
Contents: "read",
75-
Actions: "read",
76-
PullRequests: "write",
69+
// coverage is only available on github.com because tj-actions/changed-files is blocked due to their famour securits incident
70+
if !ghwCfg.IsSelfHostedRunner {
71+
// see https://github.com/fgrosse/go-coverage-report#usage
72+
codeCov := baseJob("Code coverage report", cfg.GitHubWorkflow)
73+
codeCov.If = "github.event_name == 'pull_request'"
74+
codeCov.Needs = []string{"test"}
75+
codeCov.Permissions = permissions{
76+
Contents: "read",
77+
Actions: "read",
78+
PullRequests: "write",
79+
}
80+
codeCov.addStep(jobStep{
81+
Name: "Post coverage report",
82+
Uses: core.GoCoverageReportAction,
83+
With: map[string]any{
84+
"coverage-artifact-name": coverageArtifactName,
85+
"coverage-file-name": "cover.out",
86+
},
87+
})
88+
w.Jobs["code_coverage"] = codeCov
7789
}
78-
codeCov.addStep(jobStep{
79-
Name: "Post coverage report",
80-
Uses: core.GoCoverageReportAction,
81-
With: map[string]any{
82-
"coverage-artifact-name": coverageArtifactName,
83-
"coverage-file-name": "cover.out",
84-
},
85-
})
86-
w.Jobs["code_coverage"] = codeCov
8790

8891
writeWorkflowToFile(w)
8992
}

0 commit comments

Comments
 (0)