-
Notifications
You must be signed in to change notification settings - Fork 5
31 lines (29 loc) · 1.2 KB
/
auto-approve-konflux-nudges.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
name: auto-approve-konflux-nudges
on:
workflow_dispatch: {}
schedule:
- cron: "*/30 * * * *" # At every 30 minutes
jobs:
auto-approve:
runs-on: ubuntu-latest
if: github.repository_owner == 'openshift-pipelines' # do not run this elsewhere
permissions:
pull-requests: write
steps:
- name: Checkout the current repo
uses: actions/checkout@v4
- name: auto-approve
run: |
gh auth status
git config user.name openshift-pipelines-bot
git config user.email pipelines-extcomm@redhat.com
# Approve and merge pull-request with no reviews
for p in $(gh pr list --search "author:app/red-hat-konflux chore(deps) .*" --json "title,labels,number" | jq ".[] | select((.labels | length) == 0) | .number"); do
gh pr review $p --approve --body "/lgtm"
done
# LGTM pull requests that might have one review but no more lgtm
for p in $(gh pr list --search "author:app/red-hat-konflux chore(deps) .*" --json "title,labels,number" | jq ".[] | select((.labels | length) == 1) | .number"); do
gh pr review $p --approve --body "/lgtm"
done
env:
GH_TOKEN: ${{ secrets.OPENSHIFT_PIPELINES_ROBOT }}