From 593cbd0b7f0dd1c8fb317c8ee402e64d6d63964d Mon Sep 17 00:00:00 2001 From: Olla Gabriele Date: Thu, 6 Jun 2024 12:53:27 +0200 Subject: [PATCH] improves github ref check Signed-off-by: Olla Gabriele --- coverage_comment/settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coverage_comment/settings.py b/coverage_comment/settings.py index ed0c27c1..5d4360b7 100644 --- a/coverage_comment/settings.py +++ b/coverage_comment/settings.py @@ -125,14 +125,14 @@ def clean_github_output(cls, value: str) -> pathlib.Path: @property def GITHUB_PR_NUMBER(self) -> int | None: # "refs/pull/2/merge" - if "pull" in self.GITHUB_REF: + if self.GITHUB_REF.startswith("refs/pull"): return int(self.GITHUB_REF.split("/")[2]) return None @property def GITHUB_BRANCH_NAME(self) -> str | None: # "refs/heads/my_branch_name" - if "heads" in self.GITHUB_REF: + if self.GITHUB_REF.startswith("refs/heads"): return self.GITHUB_REF.split("/", 2)[2] return None