-
Notifications
You must be signed in to change notification settings - Fork 766
89 lines (70 loc) · 3.43 KB
/
inkeep-feedback.yml
File metadata and controls
89 lines (70 loc) · 3.43 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
name: Inkeep Feedback Collector
on:
pull_request:
types: [closed]
permissions:
contents: read
pull-requests: write
issues: write
jobs:
collect-feedback:
# Only run if PR was merged, not closed
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Check for Inkeep interactions
id: check_inkeep
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.pull_request.number;
// Get all comments on the PR
const issueComments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber
});
// Get all review comments
const reviewComments = await github.rest.pulls.listReviewComments({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber
});
// Get all reviews
const reviews = await github.rest.pulls.listReviews({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber
});
// Check if any comment/review mentioned @inkeep
const hadInkeepMentions =
issueComments.data.some(c => c.body.includes('@inkeep')) ||
reviewComments.data.some(c => c.body.includes('@inkeep')) ||
reviews.data.some(r => (r.body || '').includes('@inkeep'));
console.log(`PR #${prNumber} had Inkeep mentions: ${hadInkeepMentions}`);
return hadInkeepMentions;
- name: Post feedback request
if: steps.check_inkeep.outputs.result == 'true'
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.pull_request.number;
const author = context.payload.pull_request.user.login;
const feedbackComment = `## Inkeep feedback
Thanks for working with the Inkeep bot, @${author}! Now that this PR is merged, we'd love your quick feedback to improve the experience.
### Rate your experience (1-5):
**Initial draft accuracy:**
_(1 = very inaccurate, 5 = excellent)_
**Editing needed:**
_(1 = minimal tweaks, 5 = complete rewrite)_
**What would make this more helpful?**
---
*Just reply to this comment with your ratings and tag @PostHog/team-docs-wizard. Thanks for helping us improve this workflow!*
</details>`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: feedbackComment
});
console.log(`Posted feedback request on PR #${prNumber}`);