name: Post-merge Vikunja update on: push: branches: [master] jobs: vikunja: runs-on: docker steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Update Vikunja task env: VIKUNJA_TOKEN: ${{ secrets.VIKUNJA_TOKEN }} run: | MERGE_MSG=$(git log -1 --pretty=%B) TASK_ID=$(echo "$MERGE_MSG" | grep -oE 'GRM-[0-9]+' | head -1) if [ -z "$TASK_ID" ]; then echo "No task ID in commit message, skipping Vikunja update." exit 0 fi # Resolve GRM-N identifier to Vikunja numeric task ID. # Vikunja's filter API does not support filtering by 'identifier' field, # so we list all tasks and filter client-side by project_id=6 and identifier. VIKUNJA_TASK_ID=$(curl -s \ "https://work.oblachno.oblachno.fyi/api/v1/tasks/all?per_page=50" \ -H "Authorization: Bearer ${VIKUNJA_TOKEN}" | \ python3 -c " import sys, json tasks = json.load(sys.stdin) matches = [t for t in tasks if t.get('project_id') == 6 and t.get('identifier') == '${TASK_ID}'] print(matches[0]['id'] if matches else '') ") if [ -z "$VIKUNJA_TASK_ID" ]; then echo "ERROR: Could not find Vikunja task for ${TASK_ID} in project 6" exit 1 fi CONV_MSG=$(echo "$MERGE_MSG" | head -1 | sed -E 's/^GRM-[0-9]+: //') COMMIT_SHA=$(git rev-parse HEAD) # Post HTML comment to Vikunja python3 -c " import json, os html = '
${TASK_ID}: ${CONV_MSG}
Commit: ${COMMIT_SHA}