Skip to content

Commit

Permalink
chore(loki): Enable auto-merge of dependabot pr(s) (#10029)
Browse files Browse the repository at this point in the history
**What this PR does / why we need it**:
This just enables "auto-merge" and PR is still merged only after all the
checks are passed.

Also related #10025 

**Which issue(s) this PR fixes**:
Fixes #<issue number>

**Special notes for your reviewer**:

Main rationale here is keep loki dependencies up to date and avoid
frequent toil of needing manual work to merge dependabot PR.

**Checklist**
- [x] Reviewed the
[`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md)
guide (**required**)

Signed-off-by: Kaviraj <[email protected]>
  • Loading branch information
kavirajk authored Jul 24, 2023
1 parent 14aaa21 commit 31bae5a
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/dependabot_reviewer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Auto-merge as documented in official Github docs
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions

name: Auto-review Dependabot PRs
on: pull_request_target

permissions:
pull-requests: write
contents: write

jobs:
dependabot-reviewer:
runs-on: ubuntu-latest

if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

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

# According to the doc, this just "enables" auto-merge. Meaning PR will be merged **only** if all the checks are passed.
- name: Enable auto-merge
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 comments on commit 31bae5a

Please sign in to comment.