From d0118255241e6cec30b8e6e7ae2f04604afddf0b Mon Sep 17 00:00:00 2001 From: ReachableCEO Date: Wed, 4 Dec 2024 14:14:39 -0600 Subject: [PATCH] preparing DSR automation procedure --- .gitignore | 1 + {data-gathering => dsr-input}/README.md | 0 .../dsr-gather-gitea.sh | 0 .../export-joplin-md.sh | 0 dsr-joplin-create/dsr-new.sh | 0 dsr-joplin-create/dsr-populate-objectives.sh | 0 .../create-dsr-pdf.sh | 7 ++-- {dsr-sharing => dsr-publish}/publish-dsr.sh | 19 +++++----- endstops/end-day.sh | 35 +++++++++++++++++++ endstops/start-day.sh | 9 +++++ 10 files changed, 58 insertions(+), 13 deletions(-) create mode 100644 .gitignore rename {data-gathering => dsr-input}/README.md (100%) rename data-gathering/dsr-datagather-gitea-activity.sh => dsr-input/dsr-gather-gitea.sh (100%) rename dsr-sharing/export-markdown.sh => dsr-input/export-joplin-md.sh (100%) create mode 100644 dsr-joplin-create/dsr-new.sh create mode 100644 dsr-joplin-create/dsr-populate-objectives.sh rename dsr-sharing/create-dsr.sh => dsr-publish/create-dsr-pdf.sh (53%) rename {dsr-sharing => dsr-publish}/publish-dsr.sh (89%) create mode 100644 endstops/end-day.sh create mode 100644 endstops/start-day.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..120732a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +dsrtemp/ \ No newline at end of file diff --git a/data-gathering/README.md b/dsr-input/README.md similarity index 100% rename from data-gathering/README.md rename to dsr-input/README.md diff --git a/data-gathering/dsr-datagather-gitea-activity.sh b/dsr-input/dsr-gather-gitea.sh similarity index 100% rename from data-gathering/dsr-datagather-gitea-activity.sh rename to dsr-input/dsr-gather-gitea.sh diff --git a/dsr-sharing/export-markdown.sh b/dsr-input/export-joplin-md.sh similarity index 100% rename from dsr-sharing/export-markdown.sh rename to dsr-input/export-joplin-md.sh diff --git a/dsr-joplin-create/dsr-new.sh b/dsr-joplin-create/dsr-new.sh new file mode 100644 index 0000000..e69de29 diff --git a/dsr-joplin-create/dsr-populate-objectives.sh b/dsr-joplin-create/dsr-populate-objectives.sh new file mode 100644 index 0000000..e69de29 diff --git a/dsr-sharing/create-dsr.sh b/dsr-publish/create-dsr-pdf.sh similarity index 53% rename from dsr-sharing/create-dsr.sh rename to dsr-publish/create-dsr-pdf.sh index 2c566f3..5045804 100644 --- a/dsr-sharing/create-dsr.sh +++ b/dsr-publish/create-dsr-pdf.sh @@ -1,9 +1,8 @@ #!/bin/bash -echo "Creating PDF of DSR from markdown input via pandoc..." - -INPUT_FILE="./DSR-$(date +%m-%d-%Y).md" -OUTPUT_FILE="./DSR-$(date +%m-%d-%Y).pdf" +TODAY_DATE=$(date +%m-%d-%Y) +INPUT_FILE="./DSR-$TODAY_DATE.md" +OUTPUT_FILE="./DSR-$TODAY_DATE.pdf" METADATA_FILE="daily-stakeholder-report.yml" TEMPLATE="eisvogel" diff --git a/dsr-sharing/publish-dsr.sh b/dsr-publish/publish-dsr.sh similarity index 89% rename from dsr-sharing/publish-dsr.sh rename to dsr-publish/publish-dsr.sh index 4319c00..c262b4a 100644 --- a/dsr-sharing/publish-dsr.sh +++ b/dsr-publish/publish-dsr.sh @@ -1,6 +1,5 @@ #!/bin/bash - secrets_manager() { @@ -42,9 +41,6 @@ post_dsr() { echo "Posting DSR..." -#!/bin/bash - -# Replace these with your Discourse instance details DISCOURSE_URL="https://community.turnsys.com" # e.g., https://forum.example.com API_KEY="$DISCOURSE_APIKEY" # Your API key API_USERNAME="reachableceo" # API username or admin account @@ -53,13 +49,13 @@ API_USERNAME="reachableceo" # API username or admin account CATEGORY_ID=61 # The title for the post (generated here; customize as needed) -TITLE="Daily Stakeholder Report - $(date +'%m-%d-%Y')" +TITLE="Daily Stakeholder Report - $TODAY_DATE" # The content of the post -CONTENT="Please see the attached PDF for today's report." +CONTENT="Please use the link below to download today's stakeholder report." # The file to upload (from the second argument or auto-generated based on date) -FILE_PATH="./DSR-"$(date +%m-%d-%Y)".pdf" +FILE_PATH="./DSR-$TODAY_DATE.pdf" # Check if the file exists if [ ! -f "$FILE_PATH" ]; then @@ -91,7 +87,7 @@ fi echo "File uploaded successfully. Short URL: $short_url" # Append the file link to the post content (Markdown format) -CONTENT="$CONTENT\n\n[Download the PDF]($short_url)" +CONTENT="$CONTENT\n\n[Download todays report in PDF format]($short_url)" # Create the new topic echo "Creating new topic..." @@ -118,10 +114,15 @@ else echo "$post_response" exit 1 fi + } #Get discourse api key + secrets_manager -#Create a new topic and upload/attach PDF to the topic +# - Create a new topic +# - upload PDF to discourse +# - attach uploaded PDF to the topic + post_dsr \ No newline at end of file diff --git a/endstops/end-day.sh b/endstops/end-day.sh new file mode 100644 index 0000000..8b611ff --- /dev/null +++ b/endstops/end-day.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Wrap up my instrumented day into a (mostly) automated report and publish to discourse + +# Gather DSR assets + +# My manually entered notations +./dsr-input/dsr-gather-joplin-log.sh + +# My gitea data +./dsr-input/dsr-gather-gitea.sh + +# My redmine data +./dsr-input/dsr-gather-redmine.sh + +# My wakapi data +./dsr-input/dsr-gather-waka-api.sh + +# My activity watch data +./dsr-input/dsr-gather-activitywatch.sh + +# My habit tracker data +./dsr-input/dsr-gather-habits.sh + +# My health/fitnes data +./dsr-input/dsr-gather-fitness.sh + +# My diet data +./dsr-input/dsr-gather-diet.sh + +# Produce DSR PDF asset +./dsr-publish/create-dsr-pdf.sh + +# Publish DSR to the world +./dsr-publish/publish-dsr.sh \ No newline at end of file diff --git a/endstops/start-day.sh b/endstops/start-day.sh new file mode 100644 index 0000000..b42434a --- /dev/null +++ b/endstops/start-day.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Start my instrumented day + +# Create a new blank DSR for the day +./dsr-joplin-create/dsr-new.sh + +# Populate my Joplin note "Todays objectives" section based on Redmine due dates +./dsr-joplin-create/dsr-populate-objectives.sh