Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mergify config file #300

Merged
merged 3 commits into from
Sep 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 145 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -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 }}"
Comment on lines +133 to +145
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can do something dynamic here

Suggested change
- 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 }}"
- name: dynamic backport patches to versioned branches
conditions:
- merged
- label~=^backport-v\d+\.\d+\.\d+$ # This matches labels like backport-vX.Y.Z
actions:
backport:
assignees:
- "{{ author }}"
branches:
- "{{ label.replace('backport-v', '') }}" # This extracts the version from the label and uses it as the branch name
labels:
- "backport"
title: "[{{ destination_branch }}](backport #{{ number }}) {{ title }}"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will iterate on this after i get something working