Skip to content

Commit

Permalink
Merge pull request #35871 from github/repo-sync
Browse files Browse the repository at this point in the history
Repo sync
  • Loading branch information
docs-bot authored Jan 8, 2025
2 parents 0f8a1b8 + 0adda5c commit 16e53bb
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/codeowners-legal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:
permissions:
contents: read
pull-requests: write
repository-projects: read

jobs:
codeowners-legal:
Expand All @@ -33,7 +34,7 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
# Picking this number is a "best guess". If we make it too large,
# the checkout will take potentially unnecessariily long.
# the checkout will take potentially unnecessarily long.
# This reduces the chance that tj-actions/changed-files has to
# fetch deeper history. But if it needs to, it will.
fetch-depth: 10
Expand All @@ -58,19 +59,14 @@ jobs:
CHANGED_FILE_PATHS: ${{ steps.changed-files.outputs.all_changed_files }}
CONTENT_TYPE: 'rai'

- name: Add Legal team as a reviewer
- name: Check for reviewers-legal label, add if missing and request review
if: steps.checkContentType.outputs.containsContentType == 'true'
env:
# The GH CLI uses a slightly different env name for
# the token than the GITHUB_TOKEN used by actions
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_WRITEORG_PROJECT }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR: ${{ github.event.pull_request.html_url }}
run: |
has_reviewer=$(
gh pr view $PR --json reviews |
jq 'any(.reviews[]; select(length > 0))'
)
if ! $has_reviewer
then
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
if ! echo "$labels" | grep -q 'reviewers-legal'; then
gh pr edit $PR --add-reviewer github/legal-product
gh pr edit $PR --add-label reviewers-legal
fi

0 comments on commit 16e53bb

Please sign in to comment.