diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 0000000..ee45eff --- /dev/null +++ b/.github/workflows/automerge.yml @@ -0,0 +1,25 @@ +--- +name: 🤖 Enable Auto-Merge + +# yamllint disable-line rule:truthy +on: + pull_request: {} + +permissions: + contents: read + +jobs: + automerge: + name: Enable auto-merge + if: github.event_name == 'pull_request' && (github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'renovate[bot]') + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Enable auto-merge for PR + env: + GH_TOKEN: ${{ github.token }} + PR_URL: ${{ github.event.pull_request.html_url }} + PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: gh pr merge --auto --merge --match-head-commit "$PR_HEAD_SHA" "$PR_URL" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f64cb88..0d6a601 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,20 +33,3 @@ jobs: name: Test suite steps: - run: echo Test suite completed - - automerge: - name: Enable auto-merge - if: github.event_name == 'pull_request' && (github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'renovate[bot]') - needs: - - tests - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - - name: Enable auto-merge for PR - env: - GH_TOKEN: ${{ github.token }} - PR_URL: ${{ github.event.pull_request.html_url }} - PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} - run: gh pr merge --auto --merge --match-head-commit "$PR_HEAD_SHA" "$PR_URL" diff --git a/TEMPLATES.md b/TEMPLATES.md index 801f7a7..a1266b2 100644 --- a/TEMPLATES.md +++ b/TEMPLATES.md @@ -109,7 +109,6 @@ merge Dependabot and Renovate pull requests after successful CI. | `test_repository` | empty | Optional repository checked out before tests | | `test_commands` | `[]` | Shell commands for the `Test image` step | | `post_test_commands` | `[]` | Shell commands for diagnostics after tests | -| `automerge` | `true` | Enables auto-merge for Dependabot and Renovate pull requests | Example: diff --git a/config_defaults.yml b/config_defaults.yml index 93b34a6..2fd55df 100644 --- a/config_defaults.yml +++ b/config_defaults.yml @@ -27,7 +27,6 @@ renovate.json: test_repository: test_commands: [] post_test_commands: [] - automerge: true .github/workflows/security_scanning.yml: scan_job_name: Scan ci container fail_build: false diff --git a/moduleroot/.github/workflows/automerge.yml.erb b/moduleroot/.github/workflows/automerge.yml.erb new file mode 100644 index 0000000..ed56357 --- /dev/null +++ b/moduleroot/.github/workflows/automerge.yml.erb @@ -0,0 +1,28 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: 🤖 Enable Auto-Merge + +# yamllint disable-line rule:truthy +on: + pull_request: {} + +permissions: + contents: read + +jobs: + automerge: + name: Enable auto-merge + if: github.event_name == 'pull_request' && (github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'renovate[bot]') + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Enable auto-merge for PR + env: + GH_TOKEN: ${{ github.token }} + PR_URL: ${{ github.event.pull_request.html_url }} + PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: gh pr merge --auto --merge --match-head-commit "$PR_HEAD_SHA" "$PR_URL" diff --git a/moduleroot/.github/workflows/ci.yml.erb b/moduleroot/.github/workflows/ci.yml.erb index bc5582d..c5f2fa4 100644 --- a/moduleroot/.github/workflows/ci.yml.erb +++ b/moduleroot/.github/workflows/ci.yml.erb @@ -127,22 +127,3 @@ jobs: uses: re-actors/alls-green@release/v1 with: jobs: ${{ toJSON(needs) }} -<%- if @configs['automerge'] -%> - - automerge: - name: Enable auto-merge - if: github.event_name == 'pull_request' && (github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'renovate[bot]') - needs: - - tests - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - - name: Enable auto-merge for PR - env: - GH_TOKEN: ${{ github.token }} - PR_URL: ${{ github.event.pull_request.html_url }} - PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} - run: gh pr merge --auto --merge --match-head-commit "$PR_HEAD_SHA" "$PR_URL" -<%- end -%>