Skip to content

Commit

Permalink
[ISSUE apache#128] Use GitHub CLI comment to auto-merge a Dependabo…
Browse files Browse the repository at this point in the history
…t PR (apache#129)

* Use GitHub CLI `comment`

* Adjust back interval
  • Loading branch information
Pil0tXia authored Apr 18, 2024
1 parent e934ca2 commit 33b5c1a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ updates:
directory: "/"
open-pull-requests-limit: 10
schedule:
interval: "daily" # TODO Temporary daily for testing auto-merge
interval: "weekly"
ignore:
- dependency-name: "*"
update-types: [ "version-update:semver-major" ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ permissions:
pull-requests: write

jobs:
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions
# Pull request Auto merge is not enabled for this repository
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
Expand All @@ -33,15 +35,16 @@ jobs:
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Approve a PR
- name: Approve PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Enable auto-merge for Dependabot PRs
# comment '@dependabot merge' to merge the PR
- name: Comment and Merge PR
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
run: gh pr merge --auto --merge "$PR_URL"
run: gh pr comment $PR_URL -b "@dependabot merge"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 comments on commit 33b5c1a

Please sign in to comment.