Skip to content

Commit

Permalink
okay just normal
Browse files Browse the repository at this point in the history
  • Loading branch information
asucrews authored Jul 5, 2024
1 parent 205848e commit d373633
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions scripts/update_blueprints.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import subprocess
from datetime import datetime
import urllib.parse

# Directory containing blueprint files
blueprint_directory = 'automations'
Expand All @@ -18,13 +17,6 @@ def get_last_commit_date(file_path):
date = datetime.strptime(result.stdout.strip(), '%a %b %d %H:%M:%S %Y %z')
return date.strftime('%Y-%m-%d')

def generate_shield_url(label, message, color):
"""Generate a shields.io URL for a custom badge."""
label = urllib.parse.quote(label)
message = urllib.parse.quote(message)
color = urllib.parse.quote(color)
return f"https://img.shields.io/badge/{label}-{message}-{color}"

def get_blueprints(directory, ignore_folder):
"""Retrieve the list of blueprint files in the directory, ignoring specified folders."""
blueprints = []
Expand All @@ -36,10 +28,9 @@ def get_blueprints(directory, ignore_folder):
name = os.path.splitext(filename)[0]
formatted_name = ' '.join(word.capitalize() for word in name.split('_'))
last_commit_date = get_last_commit_date(filepath)
shield_url = generate_shield_url("Last updated", last_commit_date, "blue")
readme_url = f"https://github.com/asucrews/ha-blueprints/blob/main/{root}/{name}/README.md"
print(f"File: {filename}, Last Commit Date: {last_commit_date}, Shield URL: {shield_url}, README URL: {readme_url}") # Debug print statement
blueprints.append(f"- {formatted_name} [![Last updated]({shield_url})]({readme_url})")
print(f"File: {filename}, Last Commit Date: {last_commit_date}, README URL: {readme_url}") # Debug print statement
blueprints.append(f"- [{formatted_name}]({readme_url}) (Last updated: {last_commit_date})")
return blueprints

def update_readme(blueprints, readme_path):
Expand Down

0 comments on commit d373633

Please sign in to comment.