Fix logic to determine master vs PR (#65155)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/65155
This was bugged before on empty strings which caused the hook to write on any job, not just `master` regardless of the `only_on_master` flag.
Test Plan: see `[scribe] Skipping RDS write on PR` in the logs for `linux-xenial-cuda11.3-py3.6-gcc7`
Reviewed By: malfet
Differential Revision: D31029048
Pulled By: driazati
fbshipit-source-id: 77c4a60e443d8fc19990755a3a346576afee86d8