Skip to content

Reader feedback

Reader feedback #10

name: Reader feedback
# This workflow pulls reader feedback from PostHog
# and opens a GitHub issue with the last week of feedback.
# The issue will be labelled with `docs-feedback`
on:
workflow_dispatch:
schedule:
- cron: '0 18 * * SUN' # once a week on Sunday
permissions:
contents: read
issues: write
jobs:
grab_feedback_from_posthog:
name: Pull feedback using API
runs-on: ubuntu-latest
env:
POSTHOG_TOKEN: ${{ secrets.POSTHOG_PERSONAL_API_KEY }}
steps:
- name: Run script
run: |
curl --silent \
--header "Content-Type: application/json" \
--data '{ "query": { "kind": "HogQLQuery", "query": "SELECT now() - INTERVAL 7 DAY as start_time, timestamp, properties.page, properties.text, properties.sentiment from events WHERE properties.sentiment IS NOT NULL AND timestamp > start_time ORDER BY properties.sentiment ASC"}}' \
-H "Authorization: Bearer $POSTHOG_TOKEN" \
https://app.posthog.com/api/projects/48961/query | jq -r '.results | to_entries[] | "- [ ] \(.value[2])", " feedback: \(.value[3])", " Rating: \(.value[4])", " timestamp: \(.value[1])"' > feedback.md
- name: Create issue from file
id: weekly-feedback-report
uses: peter-evans/create-issue-from-file@ceef9be92406ace67ab5421f66570acf213ec395
with:
title: Weekly documentation feedback from readers
content-filepath: ./feedback.md
labels: doc-feedback