How to trigger jenkins pipeline only on merge to develop branch from github webhook trigger? I am having a problem to trigger Jenkins pipeline job based on merge any branches to develop branch only. I also did not find any webhook for merge as like bitbucket. I also tried using pull request but that triggered the job on any changes to the PR branch which is not my requirement.

I have also shared my code below and my Jenkins Configuration.
Jenkins Configuration also please note that it is develop branch but in the image I've shown */feature I have changed it to develop but still the issue is the same.

def CONTAINER_NAME=""
def CONTAINER_TAG="${env.BUILD_NUMBER}"
def CONTAINER_PORT=""
def ECR_REPO=""
def HOST_PORT=""
def URL=""
def INSTANCE_IP=""

pipeline {
  agent any
  stages {
    stage('Image Build Develop') {
      when {
        expression {
         return env.BRANCH_NAME != 'feature_cicd'
         echo env.BRANCH_NAME
        }
      } 
      steps {
        git branch: "develop", url: 'https://github.com/jenkinsci/git-parameter-plugin.git' 
        imageBuildDevelop(CONTAINER_NAME, CONTAINER_TAG)
        }
    }

    stage('Image Tag') {
      steps {
        imageTag(CONTAINER_NAME, CONTAINER_TAG, ECR_REPO)
      }
    }

    stage('Image Push') {
      steps {
        imagePush(CONTAINER_NAME, CONTAINER_TAG, ECR_REPO)
      }
    }

    stage('Image Deploy') {
      steps {
        imageDeploy(HOST_PORT, env.BUILD_NUMBER, INSTANCE_IP)
      }
    }
  }
}

def imageBuildDevelop(containerName, tag) {
  echo "#------------------- Checkout Develop Branch -------------------#"
  git branch: "feature_cicd", url: 'https://github.com/jenkinsci/git-parameter-plugin.git'
  echo "#------------------- Login into ECR Repository -------------------#"
  sh "`/var/jenkins_home/.local/bin/aws ecr get-login --no-include-email`"
  echo "#------------------- Build Docker Image for Media-API -------------------#"
  sh "docker build -t $containerName:$tag -t $containerName ."
  echo "#------------------- Image Build Complete -------------------#"
}

def imageTag(containerName, tag, repo) {
  echo "#------------------- Tag media-api image -------------------#"
  sh "docker tag $containerName:$tag $repo:$containerName-$tag"
  echo "#------------------- Image Tag Complete ------------------#"
}

def imagePush(containerName, tag, repo) {
  echo "#------------------- Login into ECR Repository -------------------#"
  sh "`/var/jenkins_home/.local/bin/aws ecr get-login --no-include-email`"
  echo "#------------------- Push Image into ECR Repository -------------------#"
  sh "docker push $repo:$containerName-$tag"
  echo "#------------------- Image Push to ECR Repository Complete -------------------#"
}

def imageDeploy(hostPort, tag, ip) {
  echo "#------------------- SSH into media-api instance -------------------#"
  sh "ssh ubuntu@$ip \"BUILD_NUMBER=$tag\" \
  ' cd reactApi_test/ &amp;&amp;\
    echo \"TAG=${BUILD_NUMBER}\" &gt; .env &amp;&amp;\
    `aws ecr get-login --no-include-email` &amp;&amp;\
    docker-compose up -d --build &amp;&amp;\
    ./test.sh '"
  echo "#------------------- Media-API container started on Port '${hostPort} (http)' -------------------#"
}
You'll want to use the CHANGE_TARGET environment variable.  If that variable exists then you are dealing with a merge request. 

You can use the following code snipped to then determine the branch name and alter the job's logic depending on which branch the code is being merged into.

branchName = env.CHANGE_TARGET ? env.CHANGE_TARGET : env.BRANCH_NAME

In your code example you would replace  

        expression {
         return env.BRANCH_NAME != 'feature_cicd'
         echo env.BRANCH_NAME
        }


with   

        expression {
         branchName = env.CHANGE_TARGET ? env.CHANGE_TARGET : env.BRANCH_NAME
         return branchName != 'feature_cicd'
         echo branchName
        }