Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions app/core/api_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def extract_issue_data(raw_issue: tuple):
issue['comments'] = raw_issue[1]['comments']
issue['labels'] = [l['name'] for l in raw_issue[1].get('labels', [])]
issue['state'] = raw_issue[1].get('state', 'open')
issue['created_at'] = raw_issue[1].get('created_at', '')
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Readability: Looking good. Would be great to clean up the datetime format a little though. Probably having YYYY-MM-DD is enough. As the workflow runs daily, I don't see the need of putting time in there.

issue['updated_at'] = raw_issue[1].get('updated_at', '')

return issue
except Exception as error:
Expand Down Expand Up @@ -130,6 +132,8 @@ def render_template(csv_path, template_path, today):
'title': row['title'].replace('|', '\\|'), # Escape '|' to avoid breaking markdown table rows
'url': row['url'],
'comments': row['comments'],
'created_at': row.get('created_at', ''),
Copy link
Copy Markdown
Owner

@drkrillo drkrillo May 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cosmetic: bad indentation, you have to remove some whitespaces here

'updated_at': row.get('updated_at', ''),
})

env = Environment(loader=FileSystemLoader(template_path))
Expand Down Expand Up @@ -163,6 +167,8 @@ def write_output(issues, output_file):
'comments',
'labels',
'state'
'created_at',
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: You are omitting the comma after state.

'updated_at',
]
)
writer.writeheader()
Expand Down
6 changes: 3 additions & 3 deletions app/templates/README.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ If this repository helped you in your open source journey, consider giving it a

## Good First Issues <sub><sub>Last run: {{today}}</sub></sub>

| Repo | Language | Title | Comments |
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

template looks good!

|---|---|---|---|
| Repo | Language | Title | Comments | Created | Updated |
|---|---|---|---|---|---|
{% for result in results -%}
| {{result.repo}} | {{result.language}} | [{{result.title}}]({{result.url}}) | {{result.comments}} |
| {{result.repo}} | {{result.language}} | [{{result.title}}]({{result.url}}) | {{result.comments}} | {{result.created_at}} | {{result.updated_at}} |
{% endfor %}
46 changes: 27 additions & 19 deletions app/tests/test_api_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,25 +83,33 @@ def test_extract_repos_error(self, mock_extract_number, mock_api_client):
class TestIssueManager:
@patch('app.core.api_handler.APIClient')
def test_extract_issue_data(self, mock_api_client):
raw_issue = (
"Python",
{
"repository_url": "https://api.github.com/repos/owner/repo",
"title": "Test Issue",
"html_url": "https://github.com/owner/repo/issues/1",
"comments": 5
}
)

result = IssueManager().extract_issue_data(raw_issue)

assert result == {
"repo": "owner/repo",
"language": "Python",
"title": "Test Issue",
"url": "https://github.com/owner/repo/issues/1",
"comments": 5
}
raw_issue = (
"Python",
{
"repository_url": "https://api.github.com/repos/owner/repo",
"title": "Test Issue",
"html_url": "https://github.com/owner/repo/issues/1",
"comments": 5,
"labels": [],
"state": "open",
"created_at": "2024-01-15T10:00:00Z",
Copy link
Copy Markdown
Owner

@drkrillo drkrillo May 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heads up:
Nice job adding the tests.
If you modify the date format as suggested, you'll need a minimum refactor here

"updated_at": "2024-02-20T12:00:00Z",
}
)

result = IssueManager().extract_issue_data(raw_issue)

assert result == {
"repo": "owner/repo",
"language": "Python",
"title": "Test Issue",
"url": "https://github.com/owner/repo/issues/1",
"comments": 5,
"labels": [],
"state": "open",
"created_at": "2024-01-15T10:00:00Z",
"updated_at": "2024-02-20T12:00:00Z",
}

@patch('app.core.api_handler.APIClient')
def test_extract_language(self, mock_api_client):
Expand Down