Fix CircleCI behavior for non-leaf stack PRs (#31088)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31088
Original issue:
https://github.com/pytorch/pytorch/issues/31027
The problem is that for the stacks of PRs for non-leaf PRs circleCI does not set environment variable `CIRCLE_PULL_REQUEST` which is used to filter out some jobs that should run only on `master`.
(Android job for master includes alll 4 abis (x86, x86_64, armeabi-v7a, arm64-v8a) and gradle build tries to get results from all 4 abis, for PRs we run only x86 build for resources economy. Thats why not filtered master android job fails as abis apart x86 were not scheduled)
env variable `CIRCLE_BRANCH ` is set fine and can be used as a workaround to distinguish that this is PR (published with ghstack).
Test Plan: Imported from OSS
Differential Revision: D18966385
Pulled By: IvanKobzarev
fbshipit-source-id: 644c5ef07fcf2d718b72695da2cc303da8b94ef4