complete the translation of management-tools.md #3
This file contains 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
# 当有PR提交时,通知 review tema | |
name: Notify Reviewers | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize] | |
jobs: | |
notify: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Notify Reviewers | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const { data: pullRequest } = await github.pulls.get({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.payload.pull_request.number | |
}); | |
const reviewers = pullRequest.requested_reviewers.map(reviewer => reviewer.login); | |
const reviewersString = reviewers.join(', '); | |
const body = `@${reviewersString} Please review this PR: ${pullRequest.html_url}`; | |
await github.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.payload.pull_request.number, | |
body | |
}); |