Azure DevOps - Condition / Expression that allow me to skip the a task inside of a stage

you can add below condition to any of you task/step/script which you want to run if the pipeline run is for a pull request, otherwise it will be skipped.

    - task: PowerShell@2
      displayName: Pull request check
      condition: ne(variables['System.PullRequest.PullRequestId'],'')
      inputs:
        targetType: inline
        script: |
             echo "Executing as this run is for a pull request"