diff --git a/.github/workflows/auto-merge.yaml b/.github/workflows/auto-merge.yaml index 7cc4a3f..516e64a 100644 --- a/.github/workflows/auto-merge.yaml +++ b/.github/workflows/auto-merge.yaml @@ -7,37 +7,61 @@ on: types: [submitted] workflow_call: +permissions: + contents: write + pull-requests: write + jobs: auto-merge: runs-on: ubuntu-latest steps: + - name: Is PR ready? + id: is-ready + if: > + ( + ( + !github.event.pull_request.draft && + github.event.pull_request.mergeable + ) || + contains(github.event.pull_request.labels.*.name, 'ready') + ) + run: true + - name: Is Dependabot? + id: is-dependabot if: github.event.pull_request.user.login == 'dependabot[bot]' run: true - name: Is patch update? id: patch-update if: > - success() && contains( + steps.is-dependabot.outcome == 'success' && contains( github.event.head_commit.message, 'version-update:semver-patch' ) run: true - name: Auto merge PR if: > - (success() && !github.event.pull_request.draft) || - github.event.pull_request.mergeable + ( + steps.is-ready.outcome == 'success' || + steps.is-dependabot.outcome == 'success' + ) uses: pascalgn/automerge-action@v0.16.2 env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - MERGE_LABELS: "ready" - MERGE_REMOVE_LABELS: "ready" + MERGE_LABELS: "" MERGE_METHOD: "squash" MERGE_COMMIT_MESSAGE: "automatic" MERGE_FILTER_AUTHOR: "dependabot[bot]" - MERGE_FORKS: "false" + MERGE_FORKS: "true" MERGE_RETRIES: "6" MERGE_RETRY_SLEEP: "10000" - MERGE_REQUIRED_APPROVALS: "${{ steps.patch-update.outcome == 'success' && 0 || 1 }}" + MERGE_REQUIRED_APPROVALS: "${{ + ( + steps.is-ready.outcome == 'success' || + steps.patch-update.outcome == 'success' + ) && + 0 || 1 + }}" UPDATE_LABELS: "" UPDATE_METHOD: "rebase"