Skip to content

Commit

Permalink
improves github ref check
Browse files Browse the repository at this point in the history
Signed-off-by: Olla Gabriele <[email protected]>
  • Loading branch information
ollaw committed Jun 6, 2024
1 parent 0503430 commit 593cbd0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions coverage_comment/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 593cbd0

Please sign in to comment.