-
Notifications
You must be signed in to change notification settings - Fork 0
27 lines (27 loc) · 1.29 KB
/
auto_approve_dependency_PRs.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
name: Auto Approve Dependency PRs
on:
schedule:
- cron: '*/30 * * * *'
workflow_dispatch:
jobs:
build:
if: ${{ github.repository_owner == 'alteryx' }}
runs-on: ubuntu-latest
steps:
- name: Find dependency PRs
id: find_prs
run: |
gh auth status
gh pr list --repo "${{ github.repository }}" --assignee "machineFL" --base main --state open --search "status:success review:required" --limit 1 --json number > dep_PRs_waiting_approval.json
dep_pull_request=$(cat dep_PRs_waiting_approval.json | grep -Eo "[0-9]*")
echo "{dep_pull_request}=$dep_pull_request" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.AUTO_APPROVE_TOKEN }}
- name: Approve dependency PRs and enable auto-merge
if: ${{ steps.find_prs.outputs.dep_pull_request > 1 }}
run: |
gh pr review --repo "${{ github.repository }}" --comment --body "auto approve" ${{ steps.find_prs.outputs.dep_pull_request }}
gh pr review --repo "${{ github.repository }}" --approve ${{ steps.find_prs.outputs.dep_pull_request }}
gh pr merge --repo "${{ github.repository }}" --auto --squash --delete-branch ${{ steps.find_prs.outputs.dep_pull_request }}
env:
GITHUB_TOKEN: ${{ secrets.AUTO_APPROVE_TOKEN }}