diff --git a/.mergify.yml b/.mergify.yml new file mode 100644 index 00000000..5f8f6e2d --- /dev/null +++ b/.mergify.yml @@ -0,0 +1,145 @@ +queue_rules: + - name: default + conditions: + - check-success=Test Rego Policies (pull_request) + - check-success=Update rules status (pull_request) + - check-success=Update rules metadata (pull_request) +pull_request_rules: + - name: self-assign PRs + conditions: + - -merged + - -closed + - "#assignee=0" + actions: + assign: + add_users: + - "{{ author }}" + - name: forward-port patches to main branch + conditions: + - merged + - label=forwardport-main + actions: + backport: + assignees: + - "{{ author }}" + branches: + - "main" + labels: + - "backport" + title: "[{{ destination_branch }}](backport #{{ number }}) {{ title }}" + - name: ask to resolve conflict + conditions: + - -merged + - -closed + - conflict + actions: + comment: + message: | + This pull request is now in conflicts. Could you fix it? 🙏 + To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/ + ``` + git fetch upstream + git checkout -b {{head}} upstream/{{head}} + git merge upstream/{{base}} + git push upstream {{head}} + ``` + - name: close automated pull requests with bump updates if any conflict + conditions: + - -merged + - -closed + - conflict + - author=elasticmachine + - label=automation + actions: + close: + message: | + This pull request has been automatically closed by Mergify. + There are some other up-to-date pull requests. + - name: automatic approval for mergify pull requests with changes in bump-rules + conditions: + - author=mergify[bot] + - check-success=Test Policies / Test Rego Policies (pull_request) + - check-success=Test Policies / Update rules status (pull_request) + - check-success=Test Policies / Update rules metadata (pull_request) + - label=automation + - files~=^\.mergify\.yml$ + - head~=^add-backport-next.* + actions: + review: + type: APPROVE + message: Automatically approving mergify + - name: automatic squash and merge with success checks and the files matching the regex ^.mergify.yml is modified. + conditions: + - check-success=Test Policies / Test Rego Policies (pull_request) + - check-success=Test Policies / Update rules status (pull_request) + - check-success=Test Policies / Update rules metadata (pull_request) + - label=automation + - files~=^\.mergify\.yml$ + - head~=^add-backport-next.* + - "#approved-reviews-by>=1" + actions: + queue: + method: squash + name: default + - name: delete upstream branch with changes on ^.mergify.yml that has been merged or closed + conditions: + - or: + - merged + - closed + - and: + - label=automation + - head~=^add-backport-next.* + - files~=^\.mergify\.yml$ + actions: + delete_head_branch: + - name: notify the backport has not been merged yet + conditions: + - -merged + - -closed + - author=mergify[bot] + - "#check-success>0" + - schedule=Mon-Mon 06:00-10:00[Europe/Paris] + - "#assignee>=1" + actions: + comment: + message: | + This pull request has not been merged yet. Could you please review and merge it @{{ assignee | join(', @') }}? 🙏 + - name: notify the backport policy + conditions: + - -label~=^backport + - base=main + - -merged + - -closed + actions: + comment: + message: | + This pull request does not have a backport label. Could you fix it @{{author}}? 🙏 + To fixup this pull request, you need to add the backport labels for the needed + branches, such as: + * `backport-v./d./d./d` is the label to automatically backport to the `8./d` branch. `/d` is the digit + **NOTE**: `backport-skip` has been added to this pull request. + label: + add: + - backport-skip + - name: remove-backport label + conditions: + - label~=backport-v + - -merged + - -closed + actions: + label: + remove: + - backport-skip + - name: backport patches to 8.10 branch + conditions: + - merged + - label=backport-v8.10.0 + actions: + backport: + assignees: + - "{{ author }}" + branches: + - "8.10" + labels: + - "backport" + title: "[{{ destination_branch }}](backport #{{ number }}) {{ title }}"