Skip to content

Commit 6a3cc5f

Browse files
committed
feat(dependabot): consolidate auto-approve and merge workflow
- Replaces the separate auto-approve workflow with an auto-approve-and-merge workflow for Dependabot pull requests. - Includes an additional step to approve the PR after metadata fetching. - Adjusts trigger to execute for pull requests targeting the main branch only.
1 parent d523bc0 commit 6a3cc5f

2 files changed

Lines changed: 16 additions & 29 deletions

File tree

.github/workflows/dependabot.auto.approve.yaml

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
name: Dependabot auto-merge
2-
on: pull_request
1+
name: Dependabot auto-approve-and-merge
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
37

48
permissions:
59
contents: write
@@ -10,16 +14,22 @@ jobs:
1014
runs-on: ubuntu-latest
1115
if: github.event.pull_request.user.login == 'dependabot[bot]'
1216
steps:
13-
- name: Dependabot metadata
17+
- name: Fetch Dependabot metadata
1418
id: metadata
1519
uses: dependabot/fetch-metadata@v2
1620
with:
1721
github-token: "${{ secrets.GITHUB_TOKEN }}"
1822
skip-commit-verification: true
1923
skip-verification: true
20-
- name: Enable auto-merge for Dependabot PRs
21-
# if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
24+
25+
- name: Enable auto-merge
2226
run: gh pr merge --auto --squash "$PR_URL"
2327
env:
24-
PR_URL: ${{github.event.pull_request.html_url}}
28+
PR_URL: ${{ github.event.pull_request.html_url }}
29+
GH_TOKEN: ${{ secrets.ES_GITHUB_PAT }}
30+
31+
- name: Approve the PR
32+
run: gh pr review --approve "$PR_URL"
33+
env:
34+
PR_URL: ${{ github.event.pull_request.html_url }}
2535
GH_TOKEN: ${{ secrets.ES_GITHUB_PAT }}

0 commit comments

Comments
 (0)