Skip to content

Commit 16e53bb

Browse files
authored
Merge pull request #35871 from github/repo-sync
Repo sync
2 parents 0f8a1b8 + 0adda5c commit 16e53bb

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

.github/workflows/codeowners-legal.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ on:
2020
permissions:
2121
contents: read
2222
pull-requests: write
23+
repository-projects: read
2324

2425
jobs:
2526
codeowners-legal:
@@ -33,7 +34,7 @@ jobs:
3334
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
3435
with:
3536
# 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.
3738
# This reduces the chance that tj-actions/changed-files has to
3839
# fetch deeper history. But if it needs to, it will.
3940
fetch-depth: 10
@@ -58,19 +59,14 @@ jobs:
5859
CHANGED_FILE_PATHS: ${{ steps.changed-files.outputs.all_changed_files }}
5960
CONTENT_TYPE: 'rai'
6061

61-
- name: Add Legal team as a reviewer
62+
- name: Check for reviewers-legal label, add if missing and request review
6263
if: steps.checkContentType.outputs.containsContentType == 'true'
6364
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 }}
6766
PR: ${{ github.event.pull_request.html_url }}
6867
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
7570
gh pr edit $PR --add-reviewer github/legal-product
71+
gh pr edit $PR --add-label reviewers-legal
7672
fi

0 commit comments

Comments
 (0)