-
Notifications
You must be signed in to change notification settings - Fork 66.2k
78 lines (68 loc) · 3.05 KB
/
feedback-prompt.yml
File metadata and controls
78 lines (68 loc) · 3.05 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
name: Feedback prompt for non-Docs team contributors when a PR is closed
on:
pull_request:
types: [closed]
permissions:
contents: read
pull-requests: write
jobs:
comment-on-pr:
# This workflow should only run on the 'github/docs-internal' repository because it posts a feedback request
# to non-Docs team contributors when their PR is merged into the main branch.
# The feedback request asks contributors to leave feedback on their contributing experience in Slack.
if: github.repository == 'github/docs-internal' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
runs-on: ubuntu-latest
steps:
- name: Check if PR author is in docs-content team
id: check_team
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
script: |
try {
const pr = context.payload.pull_request;
await github.rest.teams.getMembershipForUserInOrg({
org: 'github',
team_slug: 'docs-content',
username: pr.user.login,
});
// Author is in the team. Do nothing!
} catch(err) {
// Author not in team
core.exportVariable('NON_DOCS_HUBBER', 'true');
}
- name: Post changelog instructions comment
if: env.NON_DOCS_HUBBER == 'true'
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
script: |
const pr = context.payload.pull_request;
const prAuthor = pr.user.login;
const assignees = (pr.assignees ?? [])
.filter(a => a.login.toLowerCase() !== "copilot")
.map(a => "@" + a.login)
.join(" ");
let commentBody;
if (assignees) {
commentBody =
"👋 " + assignees +
" - Thanks for your contribution! " +
"If you think something could be improved about the contributor experience, please post in `#docs-contributor-feedback` on Slack.";
} else if (prAuthor.toLowerCase() !== "copilot") {
commentBody =
"👋 @" + prAuthor +
" - Thanks for your contribution! " +
"If you think something could be improved about the contributor experience, please post in `#docs-contributor-feedback` on Slack.";
} else {
// nobody to mention!
commentBody =
"👋 Thanks for your contribution! " +
"If you think something could be improved about the contributor experience, please post in `#docs-contributor-feedback` on Slack.";
}
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body: commentBody
});