diff --git a/pkg/runner/run_context.go b/pkg/runner/run_context.go index 00e67f5..5afa6f7 100644 --- a/pkg/runner/run_context.go +++ b/pkg/runner/run_context.go @@ -691,8 +691,6 @@ func (rc *RunContext) isEnabled(ctx context.Context) (bool, error) { if jobType == model.JobTypeInvalid { return false, jobTypeErr - } else if jobType != model.JobTypeDefault { - return true, nil } if !runJob { @@ -700,6 +698,10 @@ func (rc *RunContext) isEnabled(ctx context.Context) (bool, error) { return false, nil } + if jobType != model.JobTypeDefault { + return true, nil + } + img := rc.platformImage(ctx) if img == "" { for _, platformName := range rc.runsOnPlatformNames(ctx) { diff --git a/pkg/runner/run_context_test.go b/pkg/runner/run_context_test.go index 8ab643e..c9d3830 100644 --- a/pkg/runner/run_context_test.go +++ b/pkg/runner/run_context_test.go @@ -619,6 +619,17 @@ if: always()`, ""), }) rc.Run.JobID = "job2" assertObject.True(rc.isEnabled(context.Background())) + + rc = createIfTestRunContext(map[string]*model.Job{ + "job1": createJob(t, `uses: ./.github/workflows/reusable.yml`, ""), + }) + assertObject.True(rc.isEnabled(context.Background())) + + rc = createIfTestRunContext(map[string]*model.Job{ + "job1": createJob(t, `uses: ./.github/workflows/reusable.yml +if: false`, ""), + }) + assertObject.False(rc.isEnabled(context.Background())) } func TestRunContextGetEnv(t *testing.T) {