From fcd679bf43cf9a94cb6766d6a1bb497e88259cf2 Mon Sep 17 00:00:00 2001
From: gomzyakov
Date: Sun, 22 Oct 2023 21:02:04 +0500
Subject: [PATCH] Add information about issue`s latest update
---
README.md | 2 +-
src/DTO/Issue.php | 3 ++-
src/GitHubAPIClient.php | 3 ++-
src/Renderer.php | 2 +-
src/Templates/Examples/main.html | 4 ++--
src/Templates/main.html | 2 +-
src/Templates/main_card_li.html | 2 +-
7 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
index d8e8f70..5acc883 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ You're welcome to add a new project in *Good First Issues*, just follow these st
- To maintain the quality of projects in *Good First Issues*, please make sure your GitHub repository meets the following criteria:
- - It has at least three issues with the `good first issue` label. This label is already present on all repositories by default. If not, you can follow the steps [here](https://help.github.com/en/github/managing-your-work-on-github/applying-labels-to-issues-and-pull-requests).
+ - It has at least three issues with the `good first issue` label. This label is already present on all repositories by default.
- It contains a `README.md` with detailed setup instructions for the project
diff --git a/src/DTO/Issue.php b/src/DTO/Issue.php
index befba3c..4fb4fce 100644
--- a/src/DTO/Issue.php
+++ b/src/DTO/Issue.php
@@ -9,7 +9,8 @@
public function __construct(
public string $html_url,
public string $title,
- public int $number
+ public int $number,
+ public string $updated_at
) {
}
}
diff --git a/src/GitHubAPIClient.php b/src/GitHubAPIClient.php
index faee22b..d2b560a 100644
--- a/src/GitHubAPIClient.php
+++ b/src/GitHubAPIClient.php
@@ -92,7 +92,8 @@ public function requestIssues(string $repository_name): array
$issues[] = new Issue(
$data['html_url'],
$data['title'],
- $data['number']
+ $data['number'],
+ $data['updated_at']
);
}
diff --git a/src/Renderer.php b/src/Renderer.php
index aaa46b2..d37f7b4 100644
--- a/src/Renderer.php
+++ b/src/Renderer.php
@@ -92,7 +92,7 @@ private function renderCardListItemHTML(Issue $issue): string
$replace_pairs = [
'_ISSUE_HREF_' => $issue->html_url,
'_ISSUE_TITLE_' => $issue->title,
- '_ISSUE_UPDATED_AT_' => 'TODO',
+ '_ISSUE_UPDATED_AT_' => Carbon::parse($issue->updated_at)->diffForHumans(),
];
return strtr($list_item_template, $replace_pairs);
diff --git a/src/Templates/Examples/main.html b/src/Templates/Examples/main.html
index 2fca5b7..cf8651c 100644
--- a/src/Templates/Examples/main.html
+++ b/src/Templates/Examples/main.html
@@ -63,7 +63,7 @@
Set `level: 2` in phpstan.neon.dist
- upd: 17 feb 2023
+ 17 feb 2023
@@ -188,7 +188,7 @@ Good First Issue
contribution to open-source.
diff --git a/src/Templates/main.html b/src/Templates/main.html
index 71166c7..748e74c 100644
--- a/src/Templates/main.html
+++ b/src/Templates/main.html
@@ -39,7 +39,7 @@ Good First Issue
contribution to open-source.
diff --git a/src/Templates/main_card_li.html b/src/Templates/main_card_li.html
index b4bc7c2..4236cae 100644
--- a/src/Templates/main_card_li.html
+++ b/src/Templates/main_card_li.html
@@ -2,5 +2,5 @@
_ISSUE_TITLE_
- upd: _ISSUE_UPDATED_AT_
+ _ISSUE_UPDATED_AT_