CI: prevent false negatives in builds for pull requests
- [x] I have checked that this issue has not already been reported.
- [ ] ~~I have confirmed this bug exists on the latest version of pandas.~~
- [x] (optional) I have confirmed this bug exists on the master branch of pandas.

---

#### Problem description

This issue is a bit vague, because I'm not sure that I completely understand the problem. And/or it's multiple problems. Anyway:

I have opened a handful of pull requests on pandas recently, and it seems that each time I do (or when I rebase), tests fail for a different reason…unrelated to my change. In https://github.com/pandas-dev/pandas/pull/39364, for example, the build was failing because of:

1. A failing `ipython` cell run back in the `whatsnew` entry for v0.8.0 (fixed in https://github.com/pandas-dev/pandas/pull/39801, then
2. An `AttributeError: 'float' object has no attribute 'value'` error
   - [GitHub Actions run](https://github.com/pandas-dev/pandas/actions/runs/570400199)
   - [Azure Pipeline run](https://dev.azure.com/pandas-dev/pandas/_build/results?buildId=54282&view=logs&j=b516280a-8c75-541b-8ba0-ae13561718a7&t=88a240e0-0f0f-5fd5-6f10-d82e025ed5d5&l=288)

Anyway, the point is not those specific errors, but that the pandas build is relatively fragile. Upstream issues cause builds for pull requests to fail with errors that have nothing to do with the change, which is confusing for people trying to contribute. This could be because:

- Changes that break the build get merged
- Builds are flaky
- ?

Some ideas of how to help:

- Enable [branch protection](https://docs.github.com/en/github/administering-a-repository/about-protected-branches) on `master`
- Make the continuous integration runs conditional, to only the part of the repository changed
- Do some deeper analysis on what tests are failing most often to see if they are flaky, etc.

Curious to hear ideas from maintainers about if there are patterns of things going on that could be fixed. I imagine it makes sense to split more actionable issues and close this one after some discussion; defer to maintainers on that as well. Thanks!