mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
ci: remove reviewers when drafting or closing a PR
This commit is contained in:
parent
72652cbc46
commit
da3ef2a538
16
.github/scripts/remove-reviewers.js
vendored
Normal file
16
.github/scripts/remove-reviewers.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
module.exports = async ({github, context}) => {
|
||||
const requestedReviewers = await github.rest.pulls.listRequestedReviewers({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: context.issue.number
|
||||
});
|
||||
|
||||
const reviewers = requestedReviewers.data.users.map(e => e.login)
|
||||
|
||||
github.rest.pulls.removeRequestedReviewers({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: context.issue.number,
|
||||
reviewers: reviewers
|
||||
});
|
||||
}
|
17
.github/workflows/remove-reviewers-on-draft.yml
vendored
Normal file
17
.github/workflows/remove-reviewers-on-draft.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
name: "Remove reviewers"
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [converted_to_draft, closed]
|
||||
jobs:
|
||||
remove-reviewers:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: 'Remove reviewers'
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
const script = require('./.github/scripts/remove-reviewers.js')
|
||||
await script({github, context})
|
Loading…
Reference in New Issue
Block a user