Repo sync #5788
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Reviewers - Legal | |
| # Responsible AI content can live anywhere under content, so CODEOWNERS path matching cannot select it. | |
| # Matching PRs must request GitHub legal review. | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| types: | |
| - edited | |
| - opened | |
| - ready_for_review | |
| - reopened | |
| - synchronize | |
| paths: | |
| - 'content/**' | |
| - .github/workflows/reviewers-legal.yml | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| repository-projects: read | |
| jobs: | |
| reviewers-legal: | |
| if: >- | |
| ${{ github.repository == 'github/docs-internal' && | |
| !github.event.pull_request.draft && | |
| !contains(github.event.pull_request.labels.*.name, 'reviewers-legal') && | |
| github.event.pull_request.head.ref != 'repo-sync' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| # tj-actions/changed-files needs two commits to diff without extra API calls. | |
| fetch-depth: 2 | |
| - name: Get changed files | |
| id: changed_files | |
| uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # v47.0.5 | |
| with: | |
| files: 'content/**' | |
| - name: Set up Node and dependencies | |
| if: steps.changed_files.outputs.any_modified == 'true' | |
| uses: ./.github/actions/node-npm-setup | |
| - name: Check content type | |
| if: steps.changed_files.outputs.any_modified == 'true' | |
| id: checkContentType | |
| run: npm run check-content-type | |
| env: | |
| CHANGED_FILE_PATHS: ${{ steps.changed_files.outputs.all_modified_files }} | |
| CONTENT_TYPE: 'rai' | |
| - name: Add legal as a reviewer | |
| if: steps.checkContentType.outputs.containsContentType == 'true' | |
| uses: ./.github/actions/retry-command | |
| env: | |
| GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }} | |
| PR: ${{ github.event.pull_request.html_url }} | |
| with: | |
| command: gh pr edit $PR --add-reviewer github/legal-product --add-label reviewers-legal |