-
Notifications
You must be signed in to change notification settings - Fork 35
feat: collect and add created_at and updated_at fields - fixes #90 #106
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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', '') | ||
| issue['updated_at'] = raw_issue[1].get('updated_at', '') | ||
|
|
||
| return issue | ||
| except Exception as error: | ||
|
|
@@ -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', ''), | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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)) | ||
|
|
@@ -163,6 +167,8 @@ def write_output(issues, output_file): | |
| 'comments', | ||
| 'labels', | ||
| 'state' | ||
| 'created_at', | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: You are omitting the comma after state. |
||
| 'updated_at', | ||
| ] | ||
| ) | ||
| writer.writeheader() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 %} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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", | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Heads up: |
||
| "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): | ||
|
|
||
There was a problem hiding this comment.
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.