Skip to content

Commit

Permalink
ci: add reviewers workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Callahan Kovacs <[email protected]>
  • Loading branch information
mr-cal committed Jun 11, 2024
1 parent 6aa3696 commit 02eaddd
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 280 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/add-reviewer-label.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add `needs-starcraft-review` if starcraft-reviewers is added as a reviewer

name: add-reviewer-label

on:
pull_request:
types:
- review_requested

jobs:
add-reviewer-label:
runs-on: ubuntu-latest
steps:
- name: Add 'needs-starcraft-review' label
uses: octokit/[email protected]
with:
route: POST /repos/${{ github.repository }}/issues/$ {{ github.event.pull_request.number }}/labels
mediaType: 'application/vnd.github.v3+json'
labels: needs-starcraft-review
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/add-reviewers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# If there are not 2 reviews, re-add starcraft-reviewers when reviewed by the starcraft-reviewers team
# Otherwise, drop the `need-starcraft-review` label

name: add-reviewer

on:
pull_request_review:
types: [submitted]

jobs:
add-reviewer:
runs-on: ubuntu-latest

steps:
- name: check number of reviews
id: check-reviews
uses: octokit/[email protected]
with:
route: GET /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews
mediaType: 'application/vnd.github.v3+json'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: re-add team if there are not enough reviews
if: steps.check-reviews.outputs.data | fromJson | length < 2
uses: octokit/[email protected]
with:
route: POST /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers
mediaType: 'application/vnd.github.v3+json'
reviewers: starcraft-reviewers
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: drop label if there are enough reviews
if: steps.check-reviews.outputs.data | fromJson | length >= 2
uses: octokit/[email protected]
with:
route: DELETE /repos/${{ github.repository }}/issues/$ {{ github.event.pull_request.number }}/labels
mediaType: 'application/vnd.github.v3+json'
labels: need-starcraft-review
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62 changes: 0 additions & 62 deletions .github/workflows/publish.yaml

This file was deleted.

124 changes: 0 additions & 124 deletions .github/workflows/spread.yml

This file was deleted.

94 changes: 0 additions & 94 deletions .github/workflows/tox.yaml

This file was deleted.

0 comments on commit 02eaddd

Please sign in to comment.