diff --git a/.github/mergify.yml b/.github/mergify.yml index bf36f9d6..0d18e488 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -1,5 +1,80 @@ pull_request_rules: +- name: auto-merge + description: automatic merge for main with >= 2 approved reviews, all requested reviews have given feedback, not held, and CI is successful + conditions: + - "#approved-reviews-by>=2" + - "#review-requested=0" + - "#changes-requested-reviews-by=0" + - or: + - base=main + - base~=release-.* + - label!=hold + - label!=do-not-merge + - label!=needs-rebase + - check-success=DCO + + # If files are changed in .github/, the actionlint check must pass + - or: + - and: + # regex should match the one in .github/workflows/actionlint.yml + - files~=.github/workflows/.*\.ya?ml$ + - check-success=actionlint + - -files~=.github/workflows/.*\.ya?ml$ + + # e2e workflow + - or: + - and: + - check-success=e2e + - or: + - files~='.*\.py$' + - files~=pyproject.toml$ + - files~=requirements.*\.txt$ + - files~=.github/workflows/e2e.yml$ + - and: + - -files~='.*\.py$' + - -files~=pyproject.toml$ + - -files~=requirements.*\.txt$ + - -files~=.github/workflows/e2e.yml$ + + # lint and test must pass if files change that would trigger this job + - or: + - and: + - check-success=lint + - check-success=test-workflow-complete + - or: + # see .github/workflows/lint.yml and test.yml + - files~=.*\.py$ + - files~=pyproject.toml$ + - files~=requirements.*\.txt$ + - files~=tox.ini$ + - files~=scripts/[^/]+\.sh$ + - files~=.github/.*$ + - and: + - -files~=.*\.py$ + - -files~=pyproject.toml$ + - -files~=requirements.*\.txt$ + - -files~=tox.ini$ + - -files~=scripts/[^/]+\.sh$ + - -files~=.github/.*$ + + - or: + - and: + - or: + - files~='.*\.md' + - files='.markdownlint-cli2.yaml' + - files='.github/workflows/docs.yml' + - check-success=markdown-lint + - and: + - -files~='.*\.md' + - -files='.markdownlint-cli2.yaml' + - -files='.github/workflows/docs.yml' + + actions: + merge: + method: merge + delete_head_branch: + - name: label-cicd description: Automatically apply CI/CD label conditions: