20
20
permissions :
21
21
contents : read
22
22
pull-requests : write
23
+ repository-projects : read
23
24
24
25
jobs :
25
26
codeowners-legal :
33
34
uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
34
35
with :
35
36
# Picking this number is a "best guess". If we make it too large,
36
- # the checkout will take potentially unnecessariily long.
37
+ # the checkout will take potentially unnecessarily long.
37
38
# This reduces the chance that tj-actions/changed-files has to
38
39
# fetch deeper history. But if it needs to, it will.
39
40
fetch-depth : 10
@@ -58,19 +59,14 @@ jobs:
58
59
CHANGED_FILE_PATHS : ${{ steps.changed-files.outputs.all_changed_files }}
59
60
CONTENT_TYPE : ' rai'
60
61
61
- - name : Add Legal team as a reviewer
62
+ - name : Check for reviewers-legal label, add if missing and request review
62
63
if : steps.checkContentType.outputs.containsContentType == 'true'
63
64
env :
64
- # The GH CLI uses a slightly different env name for
65
- # the token than the GITHUB_TOKEN used by actions
66
- GH_TOKEN : ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
65
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
67
66
PR : ${{ github.event.pull_request.html_url }}
68
67
run : |
69
- has_reviewer=$(
70
- gh pr view $PR --json reviews |
71
- jq 'any(.reviews[]; select(length > 0))'
72
- )
73
- if ! $has_reviewer
74
- then
68
+ labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
69
+ if ! echo "$labels" | grep -q 'reviewers-legal'; then
75
70
gh pr edit $PR --add-reviewer github/legal-product
71
+ gh pr edit $PR --add-label reviewers-legal
76
72
fi
0 commit comments