Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions .github/workflows/workflow-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,18 @@ jobs:

# request two reviewers from OWNERS file randomly
PR_NUMBER=${{ github.event.pull_request.number }}
REVIEWERS=$(yq '.reviewers[]' OWNERS | grep -v "^$AUTHOR$" | shuf | head -n 2 | paste -sd ",")
gh pr edit $PR_NUMBER --add-reviewer $REVIEWERS
REVIEWERS=$(
yq -r '.reviewers[]' OWNERS \
| sed 's/^[ \t]*//;s/[ \t]*$//' \
| tr -d '\r' \
| grep -v "^${AUTHOR}$" \
| shuf \
| head -n 2 \
| paste -sd ","
)
if [ -n "$REVIEWERS" ]; then
gh pr edit $PR_NUMBER --add-reviewer "$REVIEWERS"
fi

# Work for issue & PR, ignore update for now
on-new-comment:
Expand Down Expand Up @@ -167,13 +177,11 @@ jobs:
# Handle hold command
# hold/unhold the PR immediately in case of unexpected auto-merge.
elif [[ "$COMMENT_LINE" =~ ^/hold ]]; then
if [[ "$LABEL" =~ ^cancel ]]; then
gh pr edit $ISSUE_NUMBER --remove-label do-not-merge/hold
echo "Remove label: do-not-merge/hold"
else
gh pr edit $ISSUE_NUMBER --add-label do-not-merge/hold
echo "Add label: do-not-merge/hold"
fi
gh pr edit $ISSUE_NUMBER --add-label do-not-merge/hold
echo "Add label: do-not-merge/hold"
elif [[ "$COMMENT_LINE" =~ ^/unhold ]]; then
gh pr edit $ISSUE_NUMBER --remove-label do-not-merge/hold
echo "Remove label: do-not-merge/hold"

# Handle cc
# Can not require review from the author.
Expand Down Expand Up @@ -462,4 +470,4 @@ jobs:
if [[ "$LABELS" == *"lgtm"* && "$LABELS" == *"approved"* && "$LABELS" != *"do-not-merge"* ]]; then
gh pr merge $PR_NUMBER --squash
echo "Auto merged"
fi
fi
Loading