From 46b3004892635fca4a10baf37e87393c95bbeb0f Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Mon, 15 Apr 2024 12:53:05 +0200 Subject: [PATCH] Create renovate_auto.yml --- .github/workflows/renovate_auto.yml | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/renovate_auto.yml diff --git a/.github/workflows/renovate_auto.yml b/.github/workflows/renovate_auto.yml new file mode 100644 index 00000000..81676548 --- /dev/null +++ b/.github/workflows/renovate_auto.yml @@ -0,0 +1,35 @@ +name: Renovate auto-merge +on: +- pull_request_target + +permissions: + contents: write + pull-requests: write + packages: read + +jobs: + dependabot: + runs-on: ubuntu-latest + if: ${{ github.actor == 'renovate[bot]' }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Approve a PR if not already approved + run: | + gh pr checkout "$PR_URL" + if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ]; + then + gh pr review --approve "$PR_URL" + else + echo "PR already approved."; + fi + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + + - name: Enable auto-merge for Renovate PRs + run: gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}