@@ -75,6 +75,26 @@ def __init__(self, slack_token: str, slack_channel_id: str):
7575 self .last_blocks_json : Optional [str ] = None
7676 self .started_at = datetime .now (timezone .utc )
7777
78+ def format_package_name (self , package_name : str , state : ReleaseState ) -> str :
79+ """Format package name with capital letter and release type.
80+
81+ Args:
82+ package_name: The raw package name
83+ state: The ReleaseState to get release type from
84+
85+ Returns:
86+ Formatted package name with capital letter and release type in parentheses
87+ """
88+ # Capitalize first letter of package name
89+ formatted = package_name .capitalize ()
90+
91+ # Add release type if available
92+ if state .meta .release_type :
93+ release_type_str = state .meta .release_type .value
94+ formatted = f"{ formatted } ({ release_type_str } )"
95+
96+ return formatted
97+
7898 def update_message (self , state : ReleaseState ) -> bool :
7999 """Post or update Slack message with release state.
80100
@@ -148,19 +168,20 @@ def _make_blocks(self, state: ReleaseState) -> List[Dict[str, Any]]:
148168 }
149169 )
150170
151- # Show started date (when SlackStatePrinter was created)
152- started_str = self .started_at .strftime ("%Y-%m-%d %H:%M:%S %Z" )
153- blocks .append (
154- {
155- "type" : "context" ,
156- "elements" : [
157- {
158- "type" : "mrkdwn" ,
159- "text" : f"*Started:* { started_str } " ,
160- }
161- ],
162- }
163- )
171+ # Show started date from state.meta.last_started_at if available
172+ if state .meta .last_started_at :
173+ started_str = state .meta .last_started_at .strftime ("%Y-%m-%d %H:%M:%S %Z" )
174+ blocks .append (
175+ {
176+ "type" : "context" ,
177+ "elements" : [
178+ {
179+ "type" : "mrkdwn" ,
180+ "text" : f"*Started:* { started_str } " ,
181+ }
182+ ],
183+ }
184+ )
164185
165186 # Legend with two columns
166187 blocks .append (
@@ -183,6 +204,9 @@ def _make_blocks(self, state: ReleaseState) -> List[Dict[str, Any]]:
183204
184205 # Process each package
185206 for package_name , package in sorted (state .packages .items ()):
207+ # Format package name with capital letter and release type
208+ formatted_name = self .format_package_name (package_name , state )
209+
186210 # Get workflow statuses
187211 build_status_emoji = self ._get_status_emoji (package , package .build )
188212 publish_status_emoji = self ._get_status_emoji (package , package .publish )
@@ -193,7 +217,7 @@ def _make_blocks(self, state: ReleaseState) -> List[Dict[str, Any]]:
193217 "type" : "section" ,
194218 "text" : {
195219 "type" : "mrkdwn" ,
196- "text" : f"*{ package_name } *\n *Build:* { build_status_emoji } | *Publish:* { publish_status_emoji } " ,
220+ "text" : f"*{ formatted_name } *\n *Build:* { build_status_emoji } | *Publish:* { publish_status_emoji } " ,
197221 },
198222 }
199223 )
0 commit comments