Skip to content

Commit 67f9c32

Browse files
committed
Hide update time if close to creation time
1 parent 95f770c commit 67f9c32

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and [Pydantic's HISTORY.md](https://github.com/pydantic/pydantic/blob/main/HISTORY.md), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [UNRELEASED]
8+
9+
### Changed
10+
11+
* In `/gh actions artifact`, the update time is now hidden if it's less than one second after the creation time.
12+
713
## `0.4.0` - 2025-08-31
814

915
### Added

bot/src/ghutils/utils/discord/views/select_artifact.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def set_artifact(
4949
repo_url = URL("https://github.com") / repo.owner.login / repo.name
5050
workflow_url = repo_url / "actions/workflows" / stripped_workflow_path
5151

52-
self.description_text.content = "\n".join([
52+
description = [
5353
f"## `{artifact.name}.zip`",
5454
f"**Workflow:** [{workflow.name}]({workflow_url})"
5555
+ (
@@ -58,19 +58,24 @@ def set_artifact(
5858
else ""
5959
),
6060
f"**Workflow run:** [{workflow_run.display_title}]({workflow_run.html_url})",
61-
*(
62-
f"**{name}:** {relative_timestamp(time)}"
63-
for name, time in [
64-
("Created", artifact.created_at),
65-
("Updated", artifact.updated_at),
66-
(
67-
"Expire" + ("d" if artifact.expired else "s"),
68-
artifact.expires_at,
69-
),
70-
]
71-
if time
72-
),
73-
])
61+
]
62+
if artifact.created_at:
63+
description.append(
64+
f"**Created:** {relative_timestamp(artifact.created_at)}"
65+
)
66+
if (
67+
artifact.updated_at
68+
and (artifact.updated_at - artifact.created_at).total_seconds() >= 1
69+
):
70+
description.append(
71+
f"**Updated:** {relative_timestamp(artifact.updated_at)}"
72+
)
73+
if artifact.expires_at:
74+
d_s = "d" if artifact.expired else "s"
75+
description.append(
76+
f"**Expire{d_s}:** {relative_timestamp(artifact.expires_at)}"
77+
)
78+
self.description_text.content = "\n".join(description)
7479

7580
self.button_row.clear_items()
7681
self.button_row.add_item(

0 commit comments

Comments
 (0)