Complete the code to run deployment only if the branch is 'main'.
if (env.BRANCH_NAME == '[1]') { echo 'Deploying to production...' }
The deployment should happen only on the 'main' branch, so the condition must check for 'main'.
Complete the code to skip deployment if the build is triggered by a pull request.
if (env.CHANGE_ID == [1]) { echo 'Deploying...' } else { echo 'Skipping deployment for pull request.' }
When the build is not a pull request, CHANGE_ID is null. So to skip deployment on PRs, check if CHANGE_ID is not null.
Fix the error in the condition to deploy only on 'release' branch and not on pull requests.
if (env.BRANCH_NAME == '[1]' && env.CHANGE_ID == null) { echo 'Deploying release build...' }
The deployment should happen only on the 'release' branch and when CHANGE_ID is null (not a pull request).
Fill both blanks to deploy only if the branch is 'main' and the build is not a pull request.
if (env.BRANCH_NAME == '[1]' && env.CHANGE_ID == [2]) { echo 'Deploying to production...' }
Deployment happens only on 'main' branch and when CHANGE_ID is null (not a pull request).
Fill all three blanks to deploy only if the branch is 'develop', the build is not a pull request, and the environment is 'staging'.
if (env.BRANCH_NAME == '[1]' && env.CHANGE_ID == [2] && env.ENVIRONMENT == '[3]') { echo 'Deploying to staging environment...' }
The deployment condition requires branch 'develop', no pull request (CHANGE_ID null), and environment 'staging'.