From 66b9730108651e90b2667ae045a40ba8263d54d9 Mon Sep 17 00:00:00 2001 From: Kelly Thomas Reardon Date: Wed, 6 May 2026 22:24:34 -0500 Subject: [PATCH] skeleton ready --- .gitea/workflows/docker-build.yaml | 69 +++++++++++ .gitignore | 4 + .postmate/collections/Donetick API.json | 38 ++++++ .postmate/postmate-history.json | 29 +++++ .postmate/postmateHeader.json | 7 ++ Dockerfile | 6 + Start-DoneTickNotifier.ps1 | 6 + docker-compose.yaml | 12 ++ ref/chore-schema.json | 152 ++++++++++++++++++++++++ 9 files changed, 323 insertions(+) create mode 100644 .gitea/workflows/docker-build.yaml create mode 100644 .gitignore create mode 100644 .postmate/collections/Donetick API.json create mode 100644 .postmate/postmate-history.json create mode 100644 .postmate/postmateHeader.json create mode 100644 Dockerfile create mode 100644 Start-DoneTickNotifier.ps1 create mode 100644 docker-compose.yaml create mode 100644 ref/chore-schema.json diff --git a/.gitea/workflows/docker-build.yaml b/.gitea/workflows/docker-build.yaml new file mode 100644 index 0000000..3343317 --- /dev/null +++ b/.gitea/workflows/docker-build.yaml @@ -0,0 +1,69 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - "**" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Compute image tag + id: tag + run: | + BRANCH="${{ gitea.ref_name }}" + + if [ "$BRANCH" = "main" ]; then + TAG="latest" + elif [[ "$BRANCH" == v* ]]; then + TAG="$BRANCH" + else + TAG="test" + fi + + echo "tag=$TAG" >> $GITHUB_OUTPUT + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: blinkfink182/donetick-notifier:${{ steps.tag.outputs.tag }} + + - name: Notify Apprise (success) + if: success() + run: | + curl -X POST \ + -H "Content-Type: application/json" \ + -d "{ + \"tags\": \"all\", + \"title\": \"Gitea Build Succeeded\", + \"body\": \"Repo: ${{ gitea.repository }}\\nBranch: ${{ gitea.ref_name }}\\nImage tag built successfully\" + }" \ + REMOVED_URL + + - name: Notify Apprise (failure) + if: failure() + run: | + curl -X POST \ + -H "Content-Type: application/json" \ + -d "{ + \"tags\": \"all\", + \"title\": \"Gitea Build Failed\", + \"body\": \"Repo: ${{ gitea.repository }}\\nBranch: ${{ gitea.ref_name }}\\nCheck logs in Gitea\" + }" \ + REMOVED_URL \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c5b4966 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.postmate/postmate-envs.json +.vscode/launch.json +.env.ps1 +debug.ps1 diff --git a/.postmate/collections/Donetick API.json b/.postmate/collections/Donetick API.json new file mode 100644 index 0000000..9b73cdb --- /dev/null +++ b/.postmate/collections/Donetick API.json @@ -0,0 +1,38 @@ +{ + "id": "7214af45-3f3b-4b7b-a9b7-ef6dbca83ab5", + "collectionName": "Donetick API", + "creatredOn": "2026-05-06T22:35:56.440Z", + "folders": [], + "requests": [ + { + "id": "2ca9a16c-8b4d-4620-8466-15daa317f7ad", + "collectionId": "7214af45-3f3b-4b7b-a9b7-ef6dbca83ab5", + "containerId": "7214af45-3f3b-4b7b-a9b7-ef6dbca83ab5", + "collectionName": "Donetick API", + "name": "Get Chores", + "url": "https://todo.ktr32.org/eapi/v1/chore", + "method": "GET", + "headers": { + "accept": "*/*", + "user-agent": "https://postmateclient.com", + "secretkey": "REMOVED_API_KEY" + }, + "body": { + "json": {} + }, + "tests": [], + "bodyFromat": "json", + "testScript": "", + "bodyFormat": "json", + "preRequestScript": "", + "preRequests": [], + "auth": { + "type": "apikey", + "key": "secretkey", + "value": "{{secretkey}}", + "addTo": "header" + }, + "cookies": [] + } + ] +} \ No newline at end of file diff --git a/.postmate/postmate-history.json b/.postmate/postmate-history.json new file mode 100644 index 0000000..b28fd15 --- /dev/null +++ b/.postmate/postmate-history.json @@ -0,0 +1,29 @@ +[ + { + "url": "https://todo.ktr32.org/eapi/v1/chore", + "method": "GET", + "headers": { + "accept": "*/*", + "user-agent": "https://postmateclient.com", + "secretkey": "REMOVED_API_KEY" + }, + "tests": [], + "preRequestScript": "", + "testScript": "", + "id": "2ca9a16c-8b4d-4620-8466-15daa317f7ad", + "name": "Get Chores", + "collectionId": "7214af45-3f3b-4b7b-a9b7-ef6dbca83ab5", + "containerId": "7214af45-3f3b-4b7b-a9b7-ef6dbca83ab5", + "collectionName": "Donetick API", + "bodyFormat": "json", + "preRequests": [], + "auth": { + "type": "apikey", + "key": "secretkey", + "value": "{{secretkey}}", + "addTo": "header" + }, + "cookies": [], + "timestamp": 1778107167278 + } +] \ No newline at end of file diff --git a/.postmate/postmateHeader.json b/.postmate/postmateHeader.json new file mode 100644 index 0000000..cd1cb84 --- /dev/null +++ b/.postmate/postmateHeader.json @@ -0,0 +1,7 @@ +[ + { + "key": "content-type", + "value": "application/json", + "default": false + } +] \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d9685ac --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM mcr.microsoft.com/powershell + +WORKDIR /data +ADD ["Start-DoneTickNotifier.ps1", "/data/"] + +ENTRYPOINT ["pwsh", "-Command", "/data/Start-DoneTickNotifier.ps1"] \ No newline at end of file diff --git a/Start-DoneTickNotifier.ps1 b/Start-DoneTickNotifier.ps1 new file mode 100644 index 0000000..72f7d28 --- /dev/null +++ b/Start-DoneTickNotifier.ps1 @@ -0,0 +1,6 @@ +[string] $dtHost = $ENV:DONETICKHOST +[string] $dtPort = $ENV:DONETICKPORT +[string] $dtAPIKey = $ENV:DONETICKAPIKEY +[string] $appriseWebhookURL = $ENV:APPRISEWEBHOOKURL +[string] $appriseWebhookTag = $ENV:APPRISEWEBHOOKTAG + diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..ef401c0 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,12 @@ +# SAMPLE DOCKER COMPOSE +services: + donetick-notifier: + container_name: donetick-notifier + image: docker.io/blinkfink182/donetick-notifier + environment: + # BELOW ARE ALL REQUIRED + - DONETICKHOST=host.docker.internal # donetick host + - DONETICKPORT=8787 # donetick port + - DONETICKAPIKEY=adminpass # donetick API key + - APPRISEWEBHOOKURL=https://apprisehost/notify/config # apprise notification url + - APPRISEWEBHOOKTAG=all # apprise notification tag \ No newline at end of file diff --git a/ref/chore-schema.json b/ref/chore-schema.json new file mode 100644 index 0000000..3d492bf --- /dev/null +++ b/ref/chore-schema.json @@ -0,0 +1,152 @@ +{ + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "frequencyType": { + "type": "string" + }, + "frequency": { + "type": "integer" + }, + "frequencyMetadata": { + "type": "object", + "properties": { + "unit": { + "type": "string" + }, + "time": { + "type": "string" + }, + "timezone": { + "type": "string" + }, + "weekPattern": { + "type": "string" + } + }, + "required": [ + "unit", + "time", + "timezone", + "weekPattern" + ] + }, + "nextDueDate": { + "type": [ + "null", + "string" + ] + }, + "isRolling": { + "type": "boolean" + }, + "assignedTo": { + "type": [ + "integer", + "null" + ] + }, + "assignees": { + "type": "array" + }, + "assignStrategy": { + "type": "string" + }, + "isActive": { + "type": "boolean" + }, + "notification": { + "type": "boolean" + }, + "notificationMetadata": { + "type": "object", + "properties": { + "templates": { + "type": "array" + } + }, + "required": [ + "templates" + ] + }, + "labels": { + "type": "null" + }, + "labelsV2": { + "type": "array" + }, + "circleId": { + "type": "integer" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "createdBy": { + "type": "integer" + }, + "updatedBy": { + "type": "integer" + }, + "thingChore": { + "type": "null" + }, + "status": { + "type": "integer" + }, + "priority": { + "type": "integer" + }, + "description": { + "type": "string" + }, + "requireApproval": { + "type": "boolean" + }, + "isPrivate": { + "type": "boolean" + }, + "completionWindow": { + "type": "integer" + } + }, + "required": [ + "id", + "name", + "frequencyType", + "frequency", + "frequencyMetadata", + "nextDueDate", + "isRolling", + "assignedTo", + "assignees", + "assignStrategy", + "isActive", + "notification", + "notificationMetadata", + "labels", + "labelsV2", + "circleId", + "createdAt", + "updatedAt", + "createdBy", + "updatedBy", + "thingChore", + "status", + "priority", + "description", + "requireApproval", + "isPrivate", + "completionWindow" + ] + } +} \ No newline at end of file