Skip to content
Open
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
11 changes: 11 additions & 0 deletions tools/actions/commit-queue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ for pr in "$@"; do
continue
fi

# Skip PR if it has only one approval and was created less than 7 days ago
pr_meta=$(gh pr view "$pr" --json reviews,createdAt)
approvals=$(echo "$pr_meta" | jq '[.reviews[] | select(.state == "APPROVED" and .authorAssociation == "MEMBER")] | unique_by(.author.login) | length')
created_at=$(echo "$pr_meta" | jq -r '.createdAt')
created_epoch=$(date -d "$created_at" +%s)
seven_days_ago=$(date -d "7 days ago" +%s)
if [ "$approvals" -le 1 ] && [ "$created_epoch" -gt "$seven_days_ago" ]; then
echo "pr ${pr} skipped, only one approval and created less than 7 days ago"
continue
fi

# Delete the commit queue label
gh pr edit "$pr" --remove-label "$COMMIT_QUEUE_LABEL"

Expand Down
Loading