Skip to content

Commit c25f8d4

Browse files
Add missing condition to code coverage ci step
1 parent 20dff50 commit c25f8d4

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
run: make build-all
3838
code_coverage:
3939
name: Code coverage report
40+
if: github.event_name == 'pull_request'
4041
needs:
4142
- test
4243
runs-on: ubuntu-latest

internal/ghworkflow/workflow.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ type job struct {
9898
// The name of the job displayed on GitHub.
9999
Name string `yaml:"name,omitempty"`
100100

101+
// You can use the if conditional to prevent a step from running unless a condition is met.
102+
If string `yaml:"if,omitempty"`
103+
101104
// List of <job_id> that must complete successfully before this job will run.
102105
Needs []string `yaml:"needs,omitempty"`
103106

internal/ghworkflow/workflow_ci.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func ciWorkflow(cfg core.Configuration, sr golang.ScanResult) {
6868

6969
// see https://github.com/fgrosse/go-coverage-report#usage
7070
codeCov := baseJob("Code coverage report", cfg.GitHubWorkflow)
71+
codeCov.If = "github.event_name == 'pull_request'"
7172
codeCov.Needs = []string{"test"}
7273
codeCov.Permissions = permissions{
7374
Contents: "read",

0 commit comments

Comments
 (0)