From 3d9bb7a0b5bbf0c494d602ff3d9e6bed268c5c37 Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Wed, 9 Oct 2024 15:39:06 +0200 Subject: [PATCH] [CCXDEV-14176] GH actions: add konflux PR automerging --- .github/workflows/bots-automerge.yml | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/.github/workflows/bots-automerge.yml b/.github/workflows/bots-automerge.yml index 9881de5..f779835 100644 --- a/.github/workflows/bots-automerge.yml +++ b/.github/workflows/bots-automerge.yml @@ -10,31 +10,25 @@ permissions: jobs: bot-automerge: runs-on: ubuntu-latest + # Check the pull request author. if: | - github.actor == 'red-hat-konflux[bot]' || - github.actor == 'dependabot[bot]' || - github.actor == 'InsightsDroid' + github.event.pull_request.user.login == 'dependabot[bot]' || + github.event.pull_request.user.login == 'red-hat-konflux[bot]' || + github.event.pull_request.user.login == 'InsightsDroid' steps: + # NOTE: PR approval does not work on PRs from forks - name: Github Actions bot approves the PR run: gh pr review --approve "$PR_URL" env: - PR_URL: ${{github.event.pull_request.html_url}} - GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{ github.token }} - name: InsightsDroid approves the PR run: gh pr review --approve "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} GH_TOKEN: ${{secrets.INSIGHTSDROID_TOKEN}} - - name: Enable auto-merge for Dependabot PRs - # We can filter depending on the semver major, minor, or patch updates, - # but let's not do it for now - # - name: Dependabot metadata - # id: metadata - # uses: dependabot/fetch-metadata@v1 - # with: - # github-token: "${{ secrets.GITHUB_TOKEN }}" - # if: steps.metadata.outputs.update-type == 'version-update:semver-patch' + - name: Enable auto-merge for PR run: gh pr merge --auto --merge "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} - GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + GH_TOKEN: ${{ github.token }}