Workflows: pull request filter


#1

It would be really nice to have a workflow filter based on if the build is running for pull-request (just like we can filter based on branch names).

We want to run extra job(s) only on pull requests


#2

Just wanted to propose the same feature :thumbsup:


#3

For CircleCI folks, could you give us an idea if this is a priority? We would also really benefit from this feature.


#4

It would be nice to be able to filter based on the base of the pull request. For example, run some jobs only on pull requests that are to be merged into master.


#5

+1 from me, would be very useful to have different workflows for PRs


#6

+1 for me, to do beta releases I need to create a whole branch for it rather than on PR into master which would be much easier


#7

Yes please.

In general, I want to run tests for pull request builds and enable “everything else” (artifact deployment, docker image creation, etc) for non-pull-request builds.

My pull request workflow might be like:

  • run tests

My branch workflow might be like:

  • run tests
  • push compiled artifacts to maven
  • generate and push docker image

#8

I would love this feature too. Use case being that I would like unit tests to run for all commits, but integration & coverage tests to only run if there is an active PR.


#9

Would detecting special keywords in the commit message be any good for this?


#10

+1 - Angular team would like this feature as well, we publish snapshot builds for all branches but only when running on upstream, not on pull requests. It’s a separate workflow job but the status shows up on all PRs even though there is nothing to do.

If a step uses encrypted secret variables, these are only available on upstream builds, not on PRs. So PR builds with a step like

openssl aes-256-cbc -d -in .circleci/github_token -k "${KEY}" -out ~/.git_credentials

fail for PR builds.

Here’s a decent workaround to quickly exit the job if it’s a PR build:

      - run:
          name: Skip this job for Pull Requests
          command: '[[ -v CIRCLE_PR_NUMBER ]] && circleci step halt || true'

#11