|
| 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: 2023-2024 Nextcloud GmbH and Nextcloud contributors |
| 7 | +# SPDX-License-Identifier: MIT |
| 8 | + |
| 9 | +name: Auto approve nextcloud/ocp |
| 10 | + |
| 11 | +on: |
| 12 | + pull_request_target: # zizmor: ignore[dangerous-triggers] |
| 13 | + branches: |
| 14 | + - main |
| 15 | + - master |
| 16 | + - stable* |
| 17 | + |
| 18 | +permissions: |
| 19 | + contents: read |
| 20 | + |
| 21 | +concurrency: |
| 22 | + group: update-nextcloud-ocp-approve-merge-${{ github.head_ref || github.run_id }} |
| 23 | + cancel-in-progress: true |
| 24 | + |
| 25 | +jobs: |
| 26 | + auto-approve-merge: |
| 27 | + if: github.actor == 'nextcloud-command' |
| 28 | + runs-on: ubuntu-latest-low |
| 29 | + permissions: |
| 30 | + # for hmarr/auto-approve-action to approve PRs |
| 31 | + pull-requests: write |
| 32 | + # for alexwilson/enable-github-automerge-action to approve PRs |
| 33 | + contents: write |
| 34 | + |
| 35 | + steps: |
| 36 | + - name: Disabled on forks |
| 37 | + if: ${{ github.event.pull_request.head.repo.full_name != github.repository }} |
| 38 | + run: | |
| 39 | + echo 'Can not approve PRs from forks' |
| 40 | + exit 1 |
| 41 | +
|
| 42 | + - uses: mdecoleman/pr-branch-name@55795d86b4566d300d237883103f052125cc7508 # v3.0.0 |
| 43 | + id: branchname |
| 44 | + with: |
| 45 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + |
| 47 | + # GitHub actions bot approve |
| 48 | + - uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v2 |
| 49 | + if: startsWith(steps.branchname.outputs.branch, 'automated/noid/') && endsWith(steps.branchname.outputs.branch, 'update-nextcloud-ocp') |
| 50 | + with: |
| 51 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + |
| 53 | + # Enable GitHub auto merge |
| 54 | + - name: Auto merge |
| 55 | + uses: alexwilson/enable-github-automerge-action@56e3117d1ae1540309dc8f7a9f2825bc3c5f06ff # main |
| 56 | + if: startsWith(steps.branchname.outputs.branch, 'automated/noid/') && endsWith(steps.branchname.outputs.branch, 'update-nextcloud-ocp') |
| 57 | + with: |
| 58 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments