diff options
author | James McCoy <jamessan@jamessan.com> | 2022-02-07 21:30:26 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-07 21:30:26 -0500 |
commit | 8ec4410cfbe01c1a56d2283391c8cd8f20916a98 (patch) | |
tree | f1eb0410a794388c70fa6d8f2a10e5ca10600841 | |
parent | 0a8bfc0214b3dc2a1bdeb4452884fbd26c0de906 (diff) | |
parent | fde169f32844d94397825745802b22449e3f1a8d (diff) | |
download | rneovim-8ec4410cfbe01c1a56d2283391c8cd8f20916a98.tar.gz rneovim-8ec4410cfbe01c1a56d2283391c8cd8f20916a98.tar.bz2 rneovim-8ec4410cfbe01c1a56d2283391c8cd8f20916a98.zip |
Merge pull request #17323 from dundargoc/ci/add-reviewer-from-label
ci: add reviewers based on label
-rw-r--r-- | .github/workflows/labeler.yml | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 3de0c453a5..5eb0185071 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -32,3 +32,39 @@ jobs: - name: "Extract commit scope and add as label" continue-on-error: true run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+\((.+)\)!?:.*|\1|')" + + add-reviewer: + runs-on: ubuntu-latest + needs: ["triage", "type-scope"] + steps: + - uses: actions/github-script@v5 + with: + script: | + const reviewers = [] + + const { data: { labels } } = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number + }) + const label_names = labels.map(label => label.name) + + if (label_names.includes('ci')) { + reviewers.push("jamessan") + } + + if (label_names.includes('vim-patch')) { + reviewers.push("seandewar") + } + + const index = reviewers.indexOf(context.actor); + if (index > -1) { + reviewers.splice(index, 1); + } + + github.rest.pulls.requestReviewers({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, + reviewers: reviewers + }); |