renovate-approve-merge.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # This workflow is provided via the organization template repository
  2. #
  3. # https://github.com/nextcloud/.github
  4. # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
  5. #
  6. # SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
  7. # SPDX-License-Identifier: MIT
  8. name: Auto approve renovate PRs
  9. on:
  10. pull_request_target:
  11. branches:
  12. - main
  13. - master
  14. - stable*
  15. permissions:
  16. contents: read
  17. concurrency:
  18. group: renovate-approve-merge-${{ github.head_ref || github.run_id }}
  19. cancel-in-progress: true
  20. jobs:
  21. auto-approve-merge:
  22. if: github.actor == 'renovate[bot]'
  23. runs-on: ubuntu-latest
  24. permissions:
  25. # for hmarr/auto-approve-action to approve PRs
  26. pull-requests: write
  27. # for alexwilson/enable-github-automerge-action to approve PRs
  28. contents: write
  29. steps:
  30. - name: Disabled on forks
  31. if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
  32. run: |
  33. echo 'Can not approve PRs from forks'
  34. exit 1
  35. - uses: mdecoleman/pr-branch-name@55795d86b4566d300d237883103f052125cc7508 # v3.0.0
  36. id: branchname
  37. with:
  38. repo-token: ${{ secrets.GITHUB_TOKEN }}
  39. # GitHub actions bot approve
  40. - uses: hmarr/auto-approve-action@f0939ea97e9205ef24d872e76833fa908a770363 # v4.0.0
  41. if: startsWith(steps.branchname.outputs.branch, 'renovate/')
  42. with:
  43. github-token: ${{ secrets.GITHUB_TOKEN }}
  44. # Enable GitHub auto merge
  45. - name: Auto merge
  46. uses: alexwilson/enable-github-automerge-action@main
  47. if: startsWith(steps.branchname.outputs.branch, 'renovate/')
  48. with:
  49. github-token: ${{ secrets.GITHUB_TOKEN }}