Skip to content

Bump actions/checkout from 2 to 4 #8

Bump actions/checkout from 2 to 4

Bump actions/checkout from 2 to 4 #8

name: Auto-approve and merge Dependabot PRs
on:
pull_request_target:
types:
- opened
- synchronize
- reopened
jobs:
auto-approve:
runs-on: ubuntu-latest
steps:
- name: Auto-approve Dependabot PR
if: github.actor == 'dependabot[bot]'
uses: hmarr/auto-approve-action@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-merge:
needs: auto-approve
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Find PR number
id: find_pr
run: |
PR_NUMBER=$(gh pr list --state open --author "dependabot[bot]" --json number --jq '.[0].number')
echo "PR_NUMBER=$PR_NUMBER"
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Debug PR Number
run: |
echo "Retrieved PR_NUMBER: $PR_NUMBER"
echo "Retrieved steps.find_pr.outputs.PR_NUMBER: ${{ steps.find_pr.outputs.PR_NUMBER }}"
env:
PR_NUMBER: ${{ env.PR_NUMBER }}
- name: Enable auto-merge
if: ${{ steps.find_pr.outputs.PR_NUMBER != '' }}
run: gh pr merge --auto --squash "$PR_NUMBER"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}