first pass at docker run
This commit is contained in:
+30
@@ -1,7 +1,10 @@
|
||||
import ai_generators.ollama_md_generator as omg
|
||||
import trilium.notes as tn
|
||||
import repo_management.repo_manager as git_repo
|
||||
from notifications.n8n import N8NWebhookJwt
|
||||
import string,os
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
tril = tn.TrilumNotes()
|
||||
|
||||
@@ -26,9 +29,36 @@ for note in tril_notes:
|
||||
tril_notes[note]['title'])
|
||||
blog_path = f"/blog_creator/generated_files/{os_friendly_title}.md"
|
||||
ai_gen.save_to_file(blog_path)
|
||||
|
||||
|
||||
# Generate commit messages and push to repo
|
||||
commit_message = ai_gen.generate_commit_message()
|
||||
git_user = os.environ["GIT_USER"]
|
||||
git_pass = os.environ["GIT_PASS"]
|
||||
repo_manager = git_repo.GitRepository("blog/", git_user, git_pass)
|
||||
repo_manager.create_copy_commit_push(blog_path, os_friendly_title, commit_message)
|
||||
|
||||
# Generate notification for Matrix
|
||||
notification_message = ai_gen.generate_notification_summary()
|
||||
secret_key = os.environ['N8N_SECRET']
|
||||
webhook_url = os.environ['N8N_WEBHOOK_URL']
|
||||
git_branch_url = f'https://git.aridgwayweb.com/armistace/blog/src/branch/{os_friendly_tile}'
|
||||
notification_string = f"""
|
||||
<h2>{tril_notes[note]['title']}</h2>
|
||||
<h3>Summary</h3>
|
||||
<p>{notification_message}</p>
|
||||
<h3>Branch</h3>
|
||||
<p>{os_friendly_title}</p>
|
||||
<p><a href="{git_branch_url}">Link to Branch</a></p>
|
||||
"""
|
||||
|
||||
payload = {
|
||||
"message": f"{notification_string}",
|
||||
"timestamp": datetime.now().isoformat()
|
||||
}
|
||||
|
||||
webhook_client = N8NWebhookJwt(secret_key, webhook_url)
|
||||
|
||||
n8n_result = webhook_client.send_webhook(payload)
|
||||
|
||||
print(f"N8N response: {n8n_result}")
|
||||
|
||||
Reference in New Issue
Block a user