Skip to content

[CI] Add auto approval/merge for helm weekly release #15858

[CI] Add auto approval/merge for helm weekly release

[CI] Add auto approval/merge for helm weekly release #15858

# 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 == 'grafanabot' }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Helm Weekly release
id: helm-weekly-release
if : contains(github.ref, 'helm-chart-weekly-')
run: echo "isHelmRelease=true" >> $GITHUB_OUTPUT
- name: Approve and auto-merge
if: (steps.helm-weekly-release.conclusion == 'success' && steps.helm-weekly-release.outputs.isHelmRelease == 'true')
run: |
gh pr merge --auto --squash "$PR_URL"
gh pr review $PR_URL \
--approve -b "**I'm approving** this pull request, since it is a helm release."
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GH_BOT_ACCESS_TOKEN}}
- name: Manual review is required
if: steps.helm-weekly-release.conclusion != 'skip' && steps.helm-weekly-release.conclusion != 'success'
run: |
gh pr comment $PR_URL --body "**This PR requires manual review.**"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}