Skip to content

Commit c90bd01

Browse files
jc-clarkrsese
andauthored
Add new workflow for auto-labeling DIY docs PRs ready-for-doc-review (#58389)
Co-authored-by: Robert Sese <734194+rsese@users.noreply.github.com>
1 parent ab486bf commit c90bd01

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Auto-add ready-for-doc-review label
2+
3+
# **What it does**: Automatically adds the "ready-for-doc-review" label to DIY docs PRs that contain content or data changes when they are opened in a non-draft state or converted from draft to ready for review.
4+
# **Why we have it**: To ensure DIY docs PRs are automatically added to the docs-content review board without requiring manual labeling.
5+
# **Who does it impact**: Contributors making content changes and docs-content reviewers.
6+
7+
on:
8+
pull_request:
9+
types:
10+
- opened
11+
- ready_for_review
12+
paths:
13+
- 'content/**'
14+
- 'data/**'
15+
16+
permissions:
17+
contents: read
18+
pull-requests: write
19+
20+
jobs:
21+
add-review-label:
22+
name: Add ready-for-doc-review label to DIY docs PRs
23+
if: github.repository == 'github/docs-internal' && github.event.pull_request.draft == false && github.actor != 'github-openapi-bot' && github.actor != 'docs-bot'
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Check out repo
28+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
29+
30+
- name: Check team membership
31+
id: membership_check
32+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
33+
with:
34+
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
35+
script: |
36+
try {
37+
await github.rest.teams.getMembershipForUserInOrg({
38+
org: 'github',
39+
team_slug: 'docs',
40+
username: context.payload.sender.login,
41+
});
42+
return true
43+
} catch(err) {
44+
console.log(err)
45+
return false
46+
}
47+
48+
- name: Add ready-for-doc-review label
49+
if: steps.membership_check.outputs.result == 'false'
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
PR_URL: ${{ github.event.pull_request.html_url }}
53+
run: |
54+
gh pr edit $PR_URL --add-label ready-for-doc-review

0 commit comments

Comments
 (0)