n-github-actions)
    * [ GitHub security features  ](/en/actions/security-guides/using-githubs-security-features-to-secure-your-use-of-github-actions)
    * [ Automatic token authentication  ](/en/actions/security-guides/automatic-token-authentication)

  * Creating actions 

    * [ About custom actions  ](/en/actions/creating-actions/about-custom-actions)
    * [ Create a Docker container action  ](/en/actions/creating-actions/creating-a-docker-container-action)
    * [ Create a JavaScript action  ](/en/actions/creating-actions/creating-a-javascript-action)
    * [ Create a composite action  ](/en/actions/creating-actions/creating-a-composite-action)
    * [ Metadata syntax  ](/en/actions/creating-actions/metadata-syntax-for-github-actions)
    * [ Dockerfile support  ](/en/actions/creating-actions/dockerfile-support-for-github-actions)
    * [ Set exit codes  ](/en/actions/creating-actions/setting-exit-codes-for-actions)
    * [ Publish in GitHub Marketplace  ](/en/actions/creating-actions/publishing-actions-in-github-marketplace)
    * [ Share from your private repository  ](/en/actions/creating-actions/sharing-actions-and-workflows-from-your-private-repository)
    * [ Share with your organization  ](/en/actions/creating-actions/sharing-actions-and-workflows-with-your-organization)
    * [ Release and maintain actions  ](/en/actions/creating-actions/releasing-and-maintaining-actions)
    * [ CLI setup action  ](/en/actions/creating-actions/developing-a-third-party-cli-action)

  * [ Guides for GitHub Actions  ](/en/actions/guides)

  * [ GitHub Actions ](/en/actions "GitHub Actions") / 
  * [ Using jobs ](/en/actions/using-jobs "Using jobs") / 
  * [ Use conditions to control job execution ](/en/actions/using-jobs/using-conditions-to-control-job-execution "Use conditions to control job execution")

#  Using conditions to control job execution

Prevent a job from running unless your conditions are met.

##  Overview

**Note:** A job that is skipped will report its status as "Success". It will
not prevent a pull request from merging, even if it is a required check.

You can use the ` jobs.<job_id>.if ` conditional to prevent a job from running
unless a condition is met. You can use any supported context and expression to
create a conditional. For more information on which contexts are supported in
this key, see " [ Contexts ](/en/actions/learn-github-
actions/contexts#context-availability) ."

**Note:** The ` jobs.<job_id>.if ` condition is evaluated before [ `
jobs.<job_id>.strategy.matrix ` ](/en/actions/using-workflows/workflow-syntax-
for-github-actions#jobsjob_idstrategymatrix) is applied.

When you use expressions in an ` if ` conditional, you can, optionally, omit
the ` ${{ }} ` expression syntax because GitHub Actions automatically
evaluates the ` if ` conditional as an expression. However, this exception
does not apply everywhere.

You must always use the ` ${{ }} ` expression syntax or escape with ` '' ` , `
"" ` , or ` () ` when the expression starts with ` ! ` , since ` ! ` is
reserved notation in YAML format. For example:

    
    
    if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
    

For more information, see " [ Expressions ](/en/actions/learn-github-
actions/expressions) ."

###  Example: Only run job for specific repository

This example uses ` if ` to control when the ` production-deploy ` job can
run. It will only run if the repository is named ` octo-repo-prod ` and is
within the ` octo-org ` organization. Otherwise, the job will be marked as
_skipped_ .

YAML

    
    
    name: example-workflow
    on: [push]
    jobs:
      production-deploy:
        if: github.repository == 'octo-org/octo-repo-prod'
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-node@v4
            with:
              node-version: '14'
          - run: npm install -g bats
    
    
    
    name: example-workflow
    on: [push]
    jobs:
      production-d