-
Notifications
You must be signed in to change notification settings - Fork 2
100 lines (89 loc) · 4.8 KB
/
weekly-docs-feedback.yml
File metadata and controls
100 lines (89 loc) · 4.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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:
Weekly_info_for_docs_team:
env:
POSTHOG_TOKEN: ${{ secrets.POSTHOG_PERSONAL_API_KEY }}
ALGOLIA_TOKEN: ${{ secrets.ALGOLIA_ANALYTICS_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: List PRs with docs-maintainer Label
run: |
set -eo pipefail # Ensure the script fails on any command error
echo "## PRs that need attention" > feedback.md
echo "Listing PRs with label: docs-maintainer" >> feedback.md
curl -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/$GITHUB_REPOSITORY/pulls?state=open" | jq -r '.[] | select(.labels[]?.name == "docs-maintainer") | "- PR number: \(.number) PR title: [\(.title)](\(.html_url))"' >> feedback.md
echo "---" >> feedback.md
- name: Collect feedback
run: |
set -eo pipefail # Ensure the script fails on any command error
echo "## Feedback from readers" >> feedback.md
echo "Three sections: feedback, top working searches, and top failed searches." >> feedback.md
echo "Please check off the feedback and failed searches as you fix them and" >> feedback.md
echo "please add the `doc-feedback` label to your PRs related to this issue." >> feedback.md
echo " " >> feedback.md
echo "You do not need to edit this issue with PR numbers, as everything with" >> feedback.md
echo "the label will show in the GitHub project." >> feedback.md
echo " " >> feedback.md
curl --silent --fail \
--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: Run Algolia scripts
run: |
set -eo pipefail # Ensure the script fails on any command error
echo " " >> feedback.md
echo "## Algolia top searches" >> feedback.md
echo " " >> feedback.md
echo "Note: Searches with zero hits are searches that are very popular and also not returning any results. They will also appear in the failed search list." >> feedback.md
echo " " >> feedback.md
curl --silent --fail \
-X GET \
-H "X-Algolia-API-Key: $ALGOLIA_TOKEN" \
-H "X-Algolia-Application-Id: ER08SJMRY1" \
"https://analytics.algolia.com/2/searches?index=starrocks" \
| jq -r '.searches | to_entries[] | "- \(.value.search)", " count this week: \(.value.count)", " Search hits: \(.value.nbHits)\n" ' >> feedback.md
echo " " >> feedback.md
echo "## Algolia top failed searches" >> feedback.md
echo " " >> feedback.md
curl --silent --fail \
-X GET \
-H "X-Algolia-API-Key: $ALGOLIA_TOKEN" \
-H "X-Algolia-Application-Id: ER08SJMRY1" \
"https://analytics.algolia.com/2/searches/noResults?index=starrocks" \
| jq -r '.searches | to_entries[] | "- [ ] \(.value.search)", " failures this week: \(.value.count)"' \
>> feedback.md
- name: Add Dependabot reminder for docs
if: always()
run: |
set -eo pipefail # Ensure the script fails on any command error
manual_dependabot_url="https://github.com/${GITHUB_REPOSITORY}/security/dependabot?q=is%3Aopen+sort%3Anewest+docs"
echo " " >> feedback.md
echo "## Dependabot alerts reminder" >> feedback.md
echo "- [ ] Check open Dependabot alerts for docs:" >> feedback.md
echo " ${manual_dependabot_url}" >> feedback.md
echo " " >> feedback.md
- name: Create issue from file
if: always()
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