Skip to content

Commit 47c3692

Browse files
subatoiCopilot
andauthored
Adds workflow to ask for contributor feedback (from non-Docs team) (#58376)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent a3fc9e7 commit 47c3692

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Feedback prompt for non-Docs team contributors when a PR is closed
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
jobs:
12+
comment-on-pr:
13+
# This workflow should only run on the 'github/docs-internal' repository because it posts a feedback request
14+
# to non-Docs team contributors when their PR is merged into the main branch.
15+
# The feedback request asks contributors to leave feedback on their contributing experience in Slack.
16+
if: github.repository == 'github/docs-internal' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
17+
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Check if PR author is in docs-content team
22+
id: check_team
23+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
24+
with:
25+
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
26+
script: |
27+
try {
28+
const pr = context.payload.pull_request;
29+
await github.rest.teams.getMembershipForUserInOrg({
30+
org: 'github',
31+
team_slug: 'docs-content',
32+
username: pr.user.login,
33+
});
34+
// Author is in the team. Do nothing!
35+
} catch(err) {
36+
// Author not in team
37+
core.exportVariable('NON_DOCS_HUBBER', 'true');
38+
}
39+
40+
- name: Post changelog instructions comment
41+
42+
if: env.NON_DOCS_HUBBER == 'true'
43+
44+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
45+
with:
46+
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
47+
script: |
48+
// Get PR author username
49+
const pr = context.payload.pull_request;
50+
const prAuthor = pr.user.login;
51+
52+
// Compose the comment body as a plain text message to post on the PR
53+
const commentBody =
54+
"👋 @" + prAuthor +
55+
" - Please leave us feedback on your contributing experience! " +
56+
"To do this, please go to `#docs-contributor-feedback` on Slack.";
57+
58+
// Post the comment
59+
await github.rest.issues.createComment({
60+
owner: context.repo.owner,
61+
repo: context.repo.repo,
62+
issue_number: pr.number,
63+
body: commentBody
64+
});

0 commit comments

Comments
 (0)