Skip to content

Commit

Permalink
Create autoapprove.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mudler authored Apr 12, 2024
1 parent 6bace9a commit 99dec69
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/autoapprove.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: ci-robbot auto-approve
on:
- pull_request_target

permissions:
contents: write
pull-requests: write
packages: read

jobs:
auto-approve:
runs-on: ubuntu-latest
if: ${{ github.actor == 'ci-robbot' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
skip-commit-verification: true

- name: Checkout repository
uses: actions/checkout@v3

- name: Approve a PR if not already approved
run: |
gh pr checkout "$PR_URL"
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ];
then
gh pr review --approve "$PR_URL"
else
echo "PR already approved.";
fi
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Enable auto-merge for Dependabot PRs
if: ${{ contains(github.event.pull_request.title, 'Bump')}}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 comments on commit 99dec69

Please sign in to comment.