Repository: nektos/act (Go)

Issue:
Job-level `if` ignored when calling a reusable workflow
### Bug report info

```plain text
act version:            0.2.53
GOOS:                   darwin
GOARCH:                 arm64
NumCPU:                 12
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
	/var/run/docker.sock
	$HOME/.docker/run/docker.sock
Config files:
	/Users/jonj/.actrc:
		-P ubuntu-latest=node:16-buster-slim
		-P ubuntu-22.04=node:16-bullseye-slim
		-P ubuntu-20.04=node:16-buster-slim
		-P ubuntu-18.04=node:16-buster-slim
Build info:
	Go version:            go1.21.3
	Module path:           command-line-arguments
	Main version:
	Main path:
	Main checksum:
	Build settings:
		-buildmode:           exe
		-compiler:            gc
		-ldflags:             -X main.version=0.2.53
		DefaultGODEBUG:       panicnil=1
		CGO_ENABLED:          1
		CGO_CFLAGS:
		CGO_CPPFLAGS:
		CGO_CXXFLAGS:
		CGO_LDFLAGS:
		GOARCH:               arm64
		GOOS:                 darwin
Docker Engine:
	Engine version:        24.0.6
	Engine runtime:        runc
	Cgroup version:        2
	Cgroup driver:         cgroupfs
	Storage driver:        overlay2
	Registry URI:          https://index.docker.io/v1/
	OS:                    Docker Desktop
	OS type:               linux
	OS version:
	OS arch:               aarch64
	OS kernel:             6.4.16-linuxkit
	OS CPU:                12
	OS memory:             7844 MB
	Security options:
		name=seccomp,profile=unconfined
		name=cgroupns
```


### Command used with act

```sh
act -vW .github/workflows/sample.yml
```


### Describe issue

If you call a reusable workflow conditionally, act ignores the conditional and always runs it. Act should respect the `if` expression when determining whether to call the reusable workflow, just as GitHub does.

Per the documentation, `if` is one of the [supported keywords](https://docs.github.com/en/actions/using-workflows/reusing-workflows#supported-keywords-for-jobs-that-call-a-reusable-workflow) for jobs that call reusable workflows.

### Link to GitHub repository

https://github.com/jenseng/dynamic-uses/actions/runs/6819338970

### Workflow content

```yml
# .github/workflows/sample.yml
name: test
on: push
jobs:
  test:
    if: false
    uses: ./.github/workflows/sample2.yml

# .github/workflows/sample2.yml
name: test
on: workflow_call
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - run: |
          echo ::error::this should not run!
          exit 1
```


### Relevant log output

```sh
WARN  ⚠ You are using Apple M-series chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. ⚠
DEBU[0000] Loading environment from /Users/jonj/projects/dynamic-uses/.env
DEBU[0000] Loading action inputs from /Users/jonj/projects/dynamic-uses/.input
DEBU[0000] Loading secrets from /Users/jonj/projects/dynamic-uses/.secrets
DEBU[0000] Loading vars from /Users/jonj/projects/dynamic-uses/.vars
DEBU[0000] Evaluated matrix inclusions: map[]
DEBU[0000] Loading workflow '/Users/jonj/projects/dynamic-uses/.github/workflows/sample.yml'
DEBU[0000] Reading workflow '/Users/jonj/projects/dynamic-uses/.github/workflows/sample.yml'
DEBU[0000] Conditional GET for notices etag=3ab79ee3-dac6-4685-b8d0-a6a766c10cbf
DEBU[0000] Preparing plan with all jobs
DEBU[0000] Using the only detected workflow event: push
DEBU[0000] Planning jobs for event: push
DEBU[0000] gc: 2023-11-09 17:59:37.871646 -0700 MST m=+0.033583084  module=artifactcache
DEBU[0000] Plan Stages: [0x1400000e2e8]
DEBU[0000] Stages Runs: [test]
DEBU[0000] Job.Name: test
DEBU[0000] Job.RawNeeds: {0 0    <nil> []    0 0}
DEBU[0000] Job.RawRunsOn: {0 0    <nil> []    0 0}
DEBU[0000] Job.Env: {0 0    <nil> []    0 0}
DEBU[0000] Job.If: {8 0 !!bool false  <nil> []    5 9}
DEBU[0000] Job.TimeoutMinutes:
DEBU[0000] Job.Services: map[]
DEBU[0000] Job.Strategy: <nil>
DEBU[0000] Job.RawContainer: {0 0    <nil> []    0 0}
DEBU[0000] Job.Defaults.Run.Shell:
DEBU[0000] Job.Defaults.Run.WorkingDirectory:
DEBU[0000] Job.Outputs: map[]
DEBU[0000] Job.Uses: ./.github/workflows/sample2.yml
DEBU[0000] Job.With: map[]
DEBU[0000] Job.Result:
DEBU[0000] Empty Strategy, matrixes=[map[]]
DEBU[0000] Job Matrices: [map[]]
DEBU[0000] Runner Matrices: map[]
DEBU[0000] Final matrix after applying user inclusions '[map[]]'
DEBU[0000] Loading revision from git directory
DEBU[0000] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
DEBU[0000] HEAD points to 'e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3'
DEBU[0000] using github ref: refs/heads/debug-act-bug6
DEBU[0000] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
DEBU[0000] Detected CPUs: 12
[test/test] [DEBUG] evaluating expression 'false'
[test/test] [DEBUG] expression 'false' evaluated to 'false'
DEBU[0000] Loading workflow '/Users/jonj/projects/dynamic-uses/.github/workflows/sample2.yml'
DEBU[0000] Reading workflow '/Users/jonj/projects/dynamic-uses/.github/workflows/sample2.yml'
DEBU[0000] Plan Stages: [0x1400011ec30]
DEBU[0000] Stages Runs: [test]
DEBU[0000] Job.Name: test
DEBU[0000] Job.RawNeeds: {0 0    <nil> []    0 0}
DEBU[0000] Job.RawRunsOn: {8 0 !!str ubuntu-latest  <nil> []    5 14}
DEBU[0000] Job.Env: {0 0    <nil> []    0 0}
DEBU[0000] Job.If: {0 0  success()  <nil> []    0 0}
DEBU[0000] Job.Steps: echo ::error::this should not run!
exit 1
DEBU[0000] Job.TimeoutMinutes:
DEBU[0000] Job.Services: map[]
DEBU[0000] Job.Strategy: <nil>
DEBU[0000] Job.RawContainer: {0 0    <nil> []    0 0}
DEBU[0000] Job.Defaults.Run.Shell:
DEBU[0000] Job.Defaults.Run.WorkingDirectory:
DEBU[0000] Job.Outputs: map[]
DEBU[0000] Job.Uses:
DEBU[0000] Job.With: map[]
DEBU[0000] Job.Result:
DEBU[0000] Empty Strategy, matrixes=[map[]]
DEBU[0000] Job Matrices: [map[]]
DEBU[0000] Runner Matrices: map[]
DEBU[0000] Final matrix after applying user inclusions '[map[]]'
[test/test] [DEBUG] Loading revision from git directory
[test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test] [DEBUG] HEAD points to 'e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3'
[test/test] [DEBUG] using github ref: refs/heads/debug-act-bug6
[test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
DEBU[0000] Detected CPUs: 12
[test/test/test] [DEBUG] evaluating expression 'success()'
[test/test/test] [DEBUG] expression 'success()' evaluated to 'true'
[test/test/test] 🚀  Start image=node:16-buster-slim
INFO[0000] Parallel tasks (0) below minimum, setting to 1
[test/test/test]   🐳  docker pull image=node:16-buster-slim platform= username= forcePull=true
[test/test/test] [DEBUG]   🐳  docker pull node:16-buster-slim
[test/test/test] [DEBUG] pulling image 'docker.io/library/node:16-buster-slim' ()
DEBU[0000] Saving notices etag=3ab79ee3-dac6-4685-b8d0-a6a766c10cbf
DEBU[0000] No new notices
[test/test/test] [DEBUG] Pulling from library/node :: 16-buster-slim
[test/test/test] [DEBUG] Digest: sha256:3ebf2875c188d22939c6ab080cfb1a4a6248cc86bae600ea8e2326aa03acdb8f ::
[test/test/test] [DEBUG] Status: Image is up to date for node:16-buster-slim ::
[test/test/test] [DEBUG] Removed container: 1f97922e525f287201e09a9d484ce056167bb504ad0c9565466554aafe6d6465
[test/test/test] [DEBUG]   🐳  docker volume rm act-test-test-test-5d1e1a4313b35f9e866f54c0a4ffe4a7eba19b60139ecb031689c9aadf598940
[test/test/test] [DEBUG]   🐳  docker volume rm act-test-test-test-5d1e1a4313b35f9e866f54c0a4ffe4a7eba19b60139ecb031689c9aadf598940-env
INFO[0001] Parallel tasks (0) below minimum, setting to 1
[test/test/test]   🐳  docker create image=node:16-buster-slim platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[test/test/test] [DEBUG] Common container.Config ==> &{Hostname: Domainname: User: AttachStdin:false AttachStdout:false AttachStderr:false ExposedPorts:map[] Tty:true OpenStdin:false StdinOnce:false Env:[RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_ARCH=ARM64 RUNNER_TEMP=/tmp LANG=C.UTF-8] Cmd:[] Healthcheck:<nil> ArgsEscaped:false Image:node:16-buster-slim Volumes:map[] WorkingDir:/Users/jonj/projects/dynamic-uses Entrypoint:[] NetworkDisabled:false MacAddress: OnBuild:[] Labels:map[] StopSignal: StopTimeout:<nil> Shell:[]}
[test/test/test] [DEBUG] Common container.HostConfig ==> &{Binds:[/var/run/docker.sock:/var/run/docker.sock] ContainerIDFile: LogConfig:{Type: Config:map[]} NetworkMode:host PortBindings:map[] RestartPolicy:{Name: MaximumRetryCount:0} AutoRemove:false VolumeDriver: VolumesFrom:[] ConsoleSize:[0 0] Annotations:map[] CapAdd:[] CapDrop:[] CgroupnsMode: DNS:[] DNSOptions:[] DNSSearch:[] ExtraHosts:[] GroupAdd:[] IpcMode: Cgroup: Links:[] OomScoreAdj:0 PidMode: Privileged:false PublishAllPorts:false ReadonlyRootfs:false SecurityOpt:[] StorageOpt:map[] Tmpfs:map[] UTSMode: UsernsMode: ShmSize:0 Sysctls:map[] Runtime: Isolation: Resources:{CPUShares:0 Memory:0 NanoCPUs:0 CgroupParent: BlkioWeight:0 BlkioWeightDevice:[] BlkioDeviceReadBps:[] BlkioDeviceWriteBps:[] BlkioDeviceReadIOps:[] BlkioDeviceWriteIOps:[] CPUPeriod:0 CPUQuota:0 CPURealtimePeriod:0 CPURealtimeRuntime:0 CpusetCpus: CpusetMems: Devices:[] DeviceCgroupRules:[] DeviceRequests:[] KernelMemory:0 KernelMemoryTCP:0 MemoryReservation:0 MemorySwap:0 MemorySwappiness:<nil> OomKillDisable:<nil> PidsLimit:<nil> Ulimits:[] CPUCount:0 CPUPercent:0 IOMaximumIOps:0 IOMaximumBandwidth:0} Mounts:[{Type:volume Source:act-toolcache Target:/toolcache ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>} {Type:volume Source:act-test-test-test-5d1e1a4313b35f9e866f54c0a4ffe4a7eba19b60139ecb031689c9aadf598940-env Target:/var/run/act ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>} {Type:volume Source:act-test-test-test-5d1e1a4313b35f9e866f54c0a4ffe4a7eba19b60139ecb031689c9aadf598940 Target:/Users/jonj/projects/dynamic-uses ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>}] MaskedPaths:[] ReadonlyPaths:[] Init:<nil>}
[test/test/test] [DEBUG] input.NetworkAliases ==> [test]
[test/test/test] [DEBUG] not a use defined config??
[test/test/test] [DEBUG] Created container name=act-test-test-test-5d1e1a4313b35f9e866f54c0a4ffe4a7eba19b60139ecb031689c9aadf598940 id=273a829978eeda53d708708dde84e43d8980385730bf174b1a975884eef4b827 from image node:16-buster-slim (platform: )
[test/test/test] [DEBUG] ENV ==> [RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_ARCH=ARM64 RUNNER_TEMP=/tmp LANG=C.UTF-8]
[test/test/test]   🐳  docker run image=node:16-buster-slim platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[test/test/test] [DEBUG] Starting container: 273a829978eeda53d708708dde84e43d8980385730bf174b1a975884eef4b827
[test/test/test] [DEBUG] Started container: 273a829978eeda53d708708dde84e43d8980385730bf174b1a975884eef4b827
[test/test/test] [DEBUG] Writing entry to tarball workflow/event.json len:2
[test/test/test] [DEBUG] Writing entry to tarball workflow/envs.txt len:0
[test/test/test] [DEBUG] Extracting content to '/var/run/act/'
[test/test/test] [DEBUG] Loading revision from git directory
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] HEAD points to 'e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3'
[test/test/test] [DEBUG] using github ref: refs/heads/debug-act-bug6
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] Loading revision from git directory
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] HEAD points to 'e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3'
[test/test/test] [DEBUG] using github ref: refs/heads/debug-act-bug6
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] Loading revision from git directory
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] HEAD points to 'e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3'
[test/test/test] [DEBUG] using github ref: refs/heads/debug-act-bug6
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] Loading revision from git directory
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] HEAD points to 'e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3'
[test/test/test] [DEBUG] using github ref: refs/heads/debug-act-bug6
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] setupEnv => map[ACT:true ACTIONS_CACHE_URL:http://172.24.80.224:50279/ CI:true GITHUB_ACTION:0 GITHUB_ACTIONS:true GITHUB_ACTION_PATH: GITHUB_ACTION_REF: GITHUB_ACTION_REPOSITORY: GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_BASE_REF: GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:test GITHUB_REF:refs/heads/debug-act-bug6 GITHUB_REF_NAME:debug-act-bug6 GITHUB_REF_TYPE:branch GITHUB_REPOSITORY:jenseng/dynamic-uses GITHUB_REPOSITORY_OWNER:jenseng GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3 GITHUB_TOKEN: GITHUB_WORKFLOW:test GITHUB_WORKSPACE:/Users/jonj/projects/dynamic-uses ImageOS:ubuntu20 RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID:]
[test/test/test] [DEBUG] Loading revision from git directory
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] HEAD points to 'e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3'
[test/test/test] [DEBUG] using github ref: refs/heads/debug-act-bug6
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] Loading revision from git directory
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] HEAD points to 'e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3'
[test/test/test] [DEBUG] using github ref: refs/heads/debug-act-bug6
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] evaluating expression ''
[test/test/test] [DEBUG] expression '' evaluated to 'true'
[test/test/test] ⭐ Run Main echo ::error::this should not run!
exit 1
[test/test/test] [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0
[test/test/test] [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0
[test/test/test] [DEBUG] Writing entry to tarball workflow/pathcmd.txt len:0
[test/test/test] [DEBUG] Writing entry to tarball workflow/envs.txt len:0
[test/test/test] [DEBUG] Writing entry to tarball workflow/SUMMARY.md len:0
[test/test/test] [DEBUG] Extracting content to '/var/run/act'
[test/test/test] [DEBUG] Loading revision from git directory
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] HEAD points to 'e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3'
[test/test/test] [DEBUG] using github ref: refs/heads/debug-act-bug6
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] Loading revision from git directory
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] HEAD points to 'e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3'
[test/test/test] [DEBUG] using github ref: refs/heads/debug-act-bug6
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] Loading revision from git directory
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] HEAD points to 'e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3'
[test/test/test] [DEBUG] using github ref: refs/heads/debug-act-bug6
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] Loading revision from git directory
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] HEAD points to 'e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3'
[test/test/test] [DEBUG] using github ref: refs/heads/debug-act-bug6
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] Wrote command

echo ::error::this should not run!
exit 1


 to 'workflow/0'
[test/test/test] [DEBUG] Writing entry to tarball workflow/0 len:44
[test/test/test] [DEBUG] Extracting content to '/var/run/act'
[test/test/test]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0] user= workdir=
[test/test/test] [DEBUG] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0]'
[test/test/test] [DEBUG] Working directory '/Users/jonj/projects/dynamic-uses'
[test/test/test]   ❗  ::error::this should not run!
[test/test/test]   ❌  Failure - Main echo ::error::this should not run!
exit 1
[test/test/test] exitcode '1': failure
[test/test/test] 🏁  Job failed
[test/test/test] [DEBUG] Loading revision from git directory
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] HEAD points to 'e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3'
[test/test/test] [DEBUG] using github ref: refs/heads/debug-act-bug6
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] Loading revision from git directory
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
[test/test/test] [DEBUG] HEAD points to 'e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3'
[test/test/test] [DEBUG] using github ref: refs/heads/debug-act-bug6
[test/test/test] [DEBUG] Found revision: e97ea9384ae2a40ee8c8eef5b4c9c2323a0df3f3
Error: Job 'test' failed
```


### Additional information

_No response_


Discussion:

Patch:
diff --git a/pkg/runner/run_context.go b/pkg/runner/run_context.go
index 00e67f5d990..5afa6f74498 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) {


Test patch:
diff --git a/pkg/runner/run_context_test.go b/pkg/runner/run_context_test.go
index 8ab643ec077..c9d3830d46a 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) {