Skip to content

github_pr_approve

github_pr_approve #760

name: github_pr_approve
on:
schedule:
- cron: 0 0 * * *
jobs:
github_pr_approve:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: support stale approve
# This provides extra approve for any PR that has:
# at least 2 reviews requested,
# at least one approve already provided,
# the approve is at least 10 days old.
run: gh pr list --json number,reviewRequests,reviews --jq '.[]|select((.reviewRequests|length > 0) and (.reviews[]|select(.state == "APPROVED" and (.submittedAt|fromdateiso8601 < now - 10*24*60*60))|length > 1) and ([.reviews[]|select(.state == "APPROVED")]|length == 1) and ([.reviews[].state]|contains(["COMMENTED"])|not) and ([.reviews[].state]|contains(["CHANGES_REQUESTED"])|not)).number' | xargs -r -l gh pr review --approve
env:
GITHUB_TOKEN: ${{ secrets.BOTBEZBOT_TOKEN }}