diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/bots-automerge.yml similarity index 51% rename from .github/workflows/dependabot-automerge.yml rename to .github/workflows/bots-automerge.yml index 10f62e51..f7798358 100644 --- a/.github/workflows/dependabot-automerge.yml +++ b/.github/workflows/bots-automerge.yml @@ -1,5 +1,5 @@ -# Set as automatically merge all the pull requests created by dependabot[bot] -name: Dependabot auto-merge +# Set as automatically merge all the pull requests created by dependabot[bot], red-hat-konflux[bot], InsightsDroid. +name: Bots auto-merge on: pull_request # This section adds write permissions to the secrets.GITHUB_TOKEN. Default is just read @@ -8,30 +8,27 @@ permissions: pull-requests: write jobs: - dependabot: + bot-automerge: runs-on: ubuntu-latest - if: github.actor == 'dependabot[bot]' + # Check the pull request author. + if: | + 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: - - name: Dependabot metadata - id: metadata - uses: dependabot/fetch-metadata@v1 - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" + # 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 - # 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}} \ No newline at end of file + GH_TOKEN: ${{ github.token }}