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
12 changes: 9 additions & 3 deletions .github/workflows/renovate-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,15 @@ jobs:
fi
printf '%s\n' "$verdict"

reviews=$(gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json reviews)
changes_requested=$(jq '[.reviews[] | select(.state == "CHANGES_REQUESTED")] | length' <<<"$reviews")
bot_approved=$(jq '[.reviews[] | select((.author.login | startswith("grafana-plugins-platform-bot")) and .state == "APPROVED")] | length' <<<"$reviews")
# latestReviews, not reviews: `--json reviews` also asks GraphQL for
# reviews.nodes[].commit, which needs `contents: read`. The app token
# only carries `pull_requests: write`, so that query fails outright as
# soon as the PR has any review, including one a rebase dismissed.
# latestReviews leaves the commit field out and is the better question
# anyway: only a reviewer's current position should count here.
reviews=$(gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json latestReviews)
changes_requested=$(jq '[.latestReviews[] | select(.state == "CHANGES_REQUESTED")] | length' <<<"$reviews")
bot_approved=$(jq '[.latestReviews[] | select((.author.login | startswith("grafana-plugins-platform-bot")) and .state == "APPROVED")] | length' <<<"$reviews")

case "$verdict" in
"VERDICT: approve"*)
Expand Down
Loading