Repo sync #1600
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: Auto-add ready-for-doc-review label | |
| # Sends DIY content changes to the docs-content review board without manual labeling. | |
| 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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| - name: Check team membership | |
| id: membership_check | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| github-token: ${{ secrets.DOCS_BOT_PAT_BASE }} | |
| script: | | |
| try { | |
| // 9919 is the github org and 325922 the docs team; numeric IDs survive renames. | |
| await github.request('GET /organizations/{org_id}/team/{team_id}/memberships/{username}', { | |
| org_id: 9919, | |
| team_id: 325922, | |
| 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.DOCS_BOT_PAT_BASE }} | |
| PR_URL: ${{ github.event.pull_request.html_url }} | |
| run: | | |
| gh pr edit $PR_URL --add-label ready-for-doc-review |