Auto Approve Dependency PRs #106213
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Approve Dependency PRs | |
on: | |
schedule: | |
- cron: '*/5 * * * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Find dependency PRs | |
id: find_prs | |
run: | | |
gh auth status | |
gh pr list --repo "${{ github.repository }}" --author "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 ::set-output name=dep_pull_request::${dep_pull_request} | |
env: | |
GITHUB_TOKEN: ${{ secrets.AUTO_APPROVE_TOKEN }} | |
- name: Approve dependency PRs and enable auto-merge | |
id: approve_prs | |
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 ${{ steps.find_prs.outputs.dep_pull_request }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.AUTO_APPROVE_TOKEN }} |