forked from monkeytypegame/monkeytype
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eae4377
commit f84bfa6
Showing
1 changed file
with
22 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,38 @@ | ||
name: Auto Label PRs | ||
name: Label PRs "waiting for review/update" | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
|
||
on: | ||
pull_request: | ||
types: [review_requested, synchronize, reopened] | ||
types: [review_requested, review_requested] | ||
pull_request_review: | ||
types: [submitted] | ||
issue_comment: | ||
types: [created] | ||
|
||
jobs: | ||
update-labels: | ||
manage-labels: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Remove 'waiting for changes' and Add 'waiting for review' label | ||
uses: actions-ecosystem/action-add-labels@v1 | ||
- name: Set up GitHub CLI | ||
uses: cli/cli@v2 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
labels: waiting for review | ||
|
||
- name: Remove 'waiting for changes' label if exists | ||
|
||
- name: Add 'waiting for review' label if review is requested | ||
if: github.event_name == 'pull_request' && github.event.action == 'review_requested' | ||
run: | | ||
gh pr edit ${{ github.event.pull_request.number }} --add-label "waiting for review" | ||
- name: Add 'waiting for update' label if changes are requested | ||
if: github.event_name == 'pull_request_review' && github.event.review.state == 'changes_requested' | ||
run: | | ||
gh pr edit ${{ github.event.pull_request.number }} --add-label "waiting for update" | ||
- name: Remove 'waiting for update' label if a comment is made by the author | ||
if: github.event_name == 'issue_comment' | ||
run: | | ||
if gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name' | grep -q 'waiting for changes'; then | ||
gh pr edit ${{ github.event.pull_request.number }} --remove-label "waiting for changes" | ||
fi | ||
comment_author=$(gh pr view ${{ github.event.issue.number }} --json author --jq '.author.login') | ||
if [ "$comment_author" == "${{ github.actor }}" ]; then | ||
gh pr edit ${{ github.event.issue.number }} --remove-label "waiting for update" | ||
fi |