Skip to content

Update review.yml #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ jobs:
import requests
import json

# Helper function to extract valid line numbers
def extract_line_number(line_info):
try:
return int(line_info.split(" ")[1]) # Extract integer after "Line"
except (IndexError, ValueError):
return None # Return None if conversion fails

# Gather GitHub event details
event_path = os.environ.get('GITHUB_EVENT_PATH')
with open(event_path, 'r') as f:
Expand Down Expand Up @@ -79,8 +86,9 @@ jobs:
line_info = parts[0].strip()
description = ":".join(parts[1:]).strip()

if "Line" in line_info:
line_number = int(line_info.split(" ")[1]) # Extract line number
# Extract valid line number
line_number = extract_line_number(line_info)
if line_number is not None:
inline_comments.append({
"path": filename,
"line": line_number,
Expand Down
Loading