-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add workflow that auto approves dependabot PRs
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
.github/workflows/auto-approve-dependabot-pull-requests-targeting-main.yml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Auto-approve Dependabot pull requests targeting `main` | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
# Needed for automatic approval | ||
pull-requests: write | ||
# Needed for automatic merge | ||
contents: write | ||
|
||
jobs: | ||
dependabot_approve_and_merge: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.actor == 'dependabot[bot]' }} | ||
|
||
steps: | ||
- name: Generate token | ||
id: generate_token | ||
uses: tibdex/[email protected] | ||
with: | ||
app_id: ${{ secrets.BOT_APP_ID }} | ||
private_key: ${{ secrets.BOT_PRIVATE_KEY }} | ||
|
||
- name: Authenticate CLI | ||
run: echo "${{ steps.generate_token.outputs.token }}" | gh auth login --with-token | ||
|
||
- name: Approve Dependabot PR | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
run: gh pr review "$PR_URL" --approve | ||
|
||
- name: Enable auto-merge for Dependabot PR | ||
run: gh pr merge "$PR_URL" --auto --merge --delete-branch | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} |