For use in PR workflows, it would be good to check the existence of System.PullRequest.SourceBranch and System.PullRequest.TargetBranch and use them rather than HEAD/HEAD~ for the file comparison to make sure that multi-commit pull requests are still captured properly.