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>
This commit is contained in:
54
.github/workflows/auto-add-ready-for-doc-review.yml
vendored
Normal file
54
.github/workflows/auto-add-ready-for-doc-review.yml
vendored
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
name: Auto-add ready-for-doc-review label
|
||||||
|
|
||||||
|
# **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.
|
||||||
|
# **Why we have it**: To ensure DIY docs PRs are automatically added to the docs-content review board without requiring manual labeling.
|
||||||
|
# **Who does it impact**: Contributors making content changes and docs-content reviewers.
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- ready_for_review
|
||||||
|
paths:
|
||||||
|
- 'content/**'
|
||||||
|
- 'data/**'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
add-review-label:
|
||||||
|
name: Add ready-for-doc-review label to DIY docs PRs
|
||||||
|
if: github.repository == 'github/docs-internal' && github.event.pull_request.draft == false && github.actor != 'github-openapi-bot' && github.actor != 'docs-bot'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repo
|
||||||
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||||
|
|
||||||
|
- name: Check team membership
|
||||||
|
id: membership_check
|
||||||
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
|
||||||
|
script: |
|
||||||
|
try {
|
||||||
|
await github.rest.teams.getMembershipForUserInOrg({
|
||||||
|
org: 'github',
|
||||||
|
team_slug: 'docs',
|
||||||
|
username: context.payload.sender.login,
|
||||||
|
});
|
||||||
|
return true
|
||||||
|
} catch(err) {
|
||||||
|
console.log(err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
- name: Add ready-for-doc-review label
|
||||||
|
if: steps.membership_check.outputs.result == 'false'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||||
|
run: |
|
||||||
|
gh pr edit $PR_URL --add-label ready-for-doc-review
|
||||||
Reference in New Issue
Block a user