Skip to content

Commit

Permalink
refactor(SPV-1087): restore mergify.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgosek-4chain committed Jan 7, 2025
1 parent ae0be49 commit 28af727
Showing 1 changed file with 218 additions and 0 deletions.
218 changes: 218 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
pull_request_rules:

# ===============================================================================
# DEPENDABOT
# ===============================================================================

- name: Automatic Merge for Dependabot Minor Version Pull Requests
conditions:
- -draft
- author~=^dependabot(|-preview)\[bot\]$
- check-success='test (1.19.x, ubuntu-latest)'
- check-success='Analyze (go)'
actions:
review:
type: APPROVE
message: Automatically approving dependabot pull request
merge:
method: merge

# ===============================================================================
# AUTOMATIC MERGE (APPROVALS)
# ===============================================================================

- name: Automatic Merge ⬇️ on Approval ✔
conditions:
- "#approved-reviews-by>=1"
- "#review-requested=0"
- "#changes-requested-reviews-by=0"
- check-success='test (1.19.x, ubuntu-latest)'
- check-success='Analyze (go)'
- -title~=(?i)wip
- label!=work-in-progress
- -draft
actions:
merge:
method: merge

# ===============================================================================
# AUTHOR
# ===============================================================================

- name: Auto-Assign Author
conditions:
- "#assignee=0"
actions:
assign:
users: ["mrz1836"]

# ===============================================================================
# ALERTS
# ===============================================================================

- name: Notify on merge
conditions:
- merged
- label=automerge
actions:
comment:
message: "✅ @{{author}}: **{{title}}** has been merged successfully."
- name: Alert on merge conflict
conditions:
- conflict
- label=automerge
actions:
comment:
message: "🆘 @{{author}}: `{{head}}` has conflicts with `{{base}}` that must be resolved."
- name: Alert on tests failure for automerge
conditions:
- label=automerge
- status-failure=commit
actions:
comment:
message: "🆘 @{{author}}: unable to merge due to CI failure."

# ===============================================================================
# LABELS
# ===============================================================================
# Automatically add labels when PRs match certain patterns
#
# NOTE:
# - single quotes for regex to avoid accidental escapes
# - Mergify leverages Python regular expressions to match rules.
#
# Semantic commit messages
# - chore: updating grunt tasks etc.; no production code change
# - docs: changes to the documentation
# - feat: feature or story
# - feature: new feature or story
# - fix: bug fix for the user, not a fix to a build script
# - idea: general idea or suggestion
# - question: question regarding code
# - test: test related changes
# - wip: work in progress PR
# ===============================================================================

- name: Work in Progress
conditions:
- "head~=(?i)^wip" # if the PR branch starts with wip/
actions:
label:
add: ["work-in-progress"]
- name: Hotfix label
conditions:
- "head~=(?i)^hotfix" # if the PR branch starts with hotfix/
actions:
label:
add: ["hot-fix"]
- name: Bug / Fix label
conditions:
- "head~=(?i)^(bug)?fix" # if the PR branch starts with (bug)?fix/
actions:
label:
add: ["bug-P3"]
- name: Documentation label
conditions:
- "head~=(?i)^docs" # if the PR branch starts with docs/
actions:
label:
add: ["documentation"]
- name: Feature label
conditions:
- "head~=(?i)^feat(ure)?" # if the PR branch starts with feat(ure)?/
actions:
label:
add: ["feature"]
- name: Chore label
conditions:
- "head~=(?i)^chore" # if the PR branch starts with chore/
actions:
label:
add: ["update"]
- name: Question label
conditions:
- "head~=(?i)^question" # if the PR branch starts with question/
actions:
label:
add: ["question"]
- name: Test label
conditions:
- "head~=(?i)^test" # if the PR branch starts with test/
actions:
label:
add: ["test"]
- name: Idea label
conditions:
- "head~=(?i)^idea" # if the PR branch starts with idea/
actions:
label:
add: ["idea"]

# ===============================================================================
# CONTRIBUTORS
# ===============================================================================

- name: Welcome New Contributors
conditions:
- and:
- author!=dependabot[bot]
- author!=mergify[bot]
- author!=allcontributors[bot]
- author!=mrz1836
- author!=icellan
- author!=dorzepowski
- author!=pawellewandowski98
- author!=arkadiuszos4chain
- author!=wregulski
- author!=mwilkosinski
actions:
comment:
message: "Welcome to our open-source project @{{author}}! 💘"

# ===============================================================================
# STALE BRANCHES
# ===============================================================================

- name: Close stale pull request
conditions:
- base=main
- -closed
- updated-at<21 days ago
actions:
close:
message: |
This pull request looks stale. Feel free to reopen it if you think it's a mistake.
label:
add: ["stale"]

# ===============================================================================
# BRANCHES
# ===============================================================================

- name: Delete head branch after merge
conditions:
- merged
actions:
delete_head_branch:

# ===============================================================================
# CONVENTION
# ===============================================================================
# https://www.conventionalcommits.org/en/v1.0.0/
# Premium feature only

#- name: Conventional Commit
# conditions:
# - "title~=^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\\(.+\\))?:"
# actions:
# post_check:
# title: |
# {% if check_succeed %}
# Title follows Conventional Commit
# {% else %}
# Title does not follow Conventional Commit
# {% endif %}
# summary: |
# {% if not check_succeed %}
# Your pull request title must follow [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/).
# {% endif %}

0 comments on commit 28af727

Please sign in to comment.