Skip to content

Commit

Permalink
Update auto-approve-dependabot.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
DonnieBLT authored May 4, 2024
1 parent a4831e8 commit bef6ffa
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions .github/workflows/auto-approve-dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
name: Approve and Merge Dependabot PRs
on: pull_request
on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: write
pull-requests: write # Added permission to interact with pull requests
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
permissions:
issues: write
pull-requests: write # Ensure this is explicitly set for the job too
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: github.actor == 'dependabot[bot]'
steps:
- name: Checkout code
uses: actions/checkout@v2 # This step is typically necessary before interacting with the PR
- name: approve
run: gh pr review --approve "$PR_URL"
- name: merge
run: gh pr merge --auto --squash --delete-branch "$PR_URL"
uses: actions/checkout@v2

- name: Install GitHub CLI
run: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 && sudo apt-add-repository https://cli.github.com/packages && sudo apt update && sudo apt install gh -y

- name: Authenticate GitHub CLI
run: echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token

- name: Approve the PR
run: gh pr review --approve "${{ github.event.pull_request.number }}"

- name: Auto-Merge the PR
run: gh pr merge --squash --auto --delete-branch "${{ github.event.pull_request.number }}"

0 comments on commit bef6ffa

Please sign in to comment.