.github/mergify.yml
pull_request_rules: [
# Critical Package
{
name: Add critical-package label,
conditions:
[
label~=(@serverlessly/core|^@serverlessly/protocol-),
label!=critical-package,
],
actions: { label: { add: [critical-package] } },
},
# Authors
{
name: Add by-core-team label,
conditions: [author=@ServerlesslyStack/core, label!=by-core-team],
actions: { label: { add: [by-core-team] } },
},
# Base Branch
{
name: Block PR if it is NOT opened against main branch,
conditions: [base!=main, label!=blocked],
actions:
{
comment:
{
message: 'Please, change the base branch to main. Pull Requests against {{base}} branch is not supported.',
},
label: { add: [blocked] },
},
},
{
name: Unblock PR if it is opened against main branch,
conditions: [base=main, label=blocked],
actions: { label: { remove: [blocked] } },
},
# Sensitive Files
{
name: Block PR if it modifies sensitive files,
conditions:
[
author!=@ServerlesslyStack/core,
files~=(^.github/|^scripts/|^configs/|^tools/),
],
actions:
{
comment:
{
message: 'You modified a sensitive file in `.github`, `scripts`, `tools` or `configs` directory which is not allowed. Please, request the changes through [Discussions](https://github.com/ServerlesslyStack/Serverlessly/discussions).',
},
label: { add: [sensitive] },
},
},
{
name: Unblock PR if it removes modified sensitive file,
conditions:
[-files~=(^.github/|^scripts/|^configs/|^tools/), label=sensitive],
actions: { label: { remove: [sensitive] } },
},
{
name: Block PR if it modifies dependencies,
conditions:
[
author!=@ServerlesslyStack/core,
'author!=dependabot[bot]',
files~=(yarn.lock|package.json),
],
actions:
{
comment:
{
message: 'You modified `package.json` or `yarn.lock` file which is not allowed. Please, request the changes through [Discussions](https://github.com/ServerlesslyStack/Serverlessly/discussions).',
},
label: { add: [forbidden] },
},
},
{
name: Unblock PR if it removes dependency files,
conditions: [-files~=(yarn.lock|package.json), label=forbidden],
actions: { label: { remove: [forbidden] } },
},
# Work in Progress
{
name: Add work-in-progress label upon finding construction emoji in title,
conditions: [title~=🚧, -closed, -merged, label!=work-in-progress],
actions: { label: { add: [work-in-progress] } },
},
{
name: Add work-in-progress label upon finding wip (case insensitive) word in title,
conditions: ['title~=(?i)wip', -closed, -merged, label!=work-in-progress],
actions: { label: { add: [work-in-progress] } },
},
{
name: Add work-in-progress label upon finding work in progress (case insensitive) word in title,
conditions:
[
'title~=(?i)work in progress',
-closed,
-merged,
label!=work-in-progress,
],
actions: { label: { add: [work-in-progress] } },
},
{
name: Remove work-in-progress label,
conditions: [check-success=WIP, label=work-in-progress],
actions: { label: { remove: [work-in-progress] } },
},
# Pull Request Title
{
name: Add pr-title-issue label,
conditions:
[
check-failure=Semantic Pull Request,
-closed,
-merged,
label!=pr-title-issue,
],
actions: { label: { add: [pr-title-issue] } },
},
{
name: Remove pr-title-issue label,
conditions: [check-success=Semantic Pull Request, label=pr-title-issue],
actions: { label: { remove: [pr-title-issue] } },
},
{
name: Request author to change PR title,
conditions:
['author!=dependabot[bot]', label=pr-title-issue, -closed, -merged],
actions:
{
comment:
{
message: 'Pull Request title `{{title}}` does not follow the guidelines of [Serverlessly Commit specification](https://github.com/ServerlesslyStack/Serverlessly/blob/main/CONTRIBUTING.md#pull-request). Please, update it.',
},
},
},
# Merge Conflict
{
name: Add merge-conflict label,
conditions: [conflict, -closed, -merged, label!=merge-conflict],
actions: { label: { add: [merge-conflict] } },
},
{
name: Remove merge-conflict label,
conditions: [-conflict, label=merge-conflict],
actions: { label: { remove: [merge-conflict] } },
},
{
name: Request author to resolve conflict,
conditions:
['author!=dependabot[bot]', label=merge-conflict, -closed, -merged],
actions:
{
comment:
{
message: 'This Pull Request is in conflict with the {{base}} branch. Please, resolve conflict either by merging {{base}} into your {{head}} branch or rebasing your {{head}} onto {{base}} branch.',
},
},
},
# Code Style
{
name: Add code-style-issue label,
conditions:
[
check-failure~=(Lint|Format Check),
-closed,
-merged,
label!=code-style-issue,
],
actions: { label: { add: [code-style-issue] } },
},
{
name: Remove code-style-issue label,
conditions:
[
check-success=Lint,
check-success=Format Check,
label=code-style-issue,
],
actions: { label: { remove: [code-style-issue] } },
},
{
name: Request author to fix style issue,
conditions: [label=code-style-issue, -closed, -merged],
actions:
{
comment:
{
message: 'Please, fix code style issues. Run `yarn lint && yarn format-check` for assistance.',
},
},
},
# Code Quality
{
name: Add maintainability-issue label,
conditions:
[
check-failure=codeclimate,
-closed,
-merged,
label!=maintainability-issue,
],
actions: { label: { add: [maintainability-issue] } },
},
{
name: Remove maintainability-issue label,
conditions: [check-success=codeclimate, label=maintainability-issue],
actions: { label: { remove: [maintainability-issue] } },
},
# Test Coverage
{
name: Add untested-code label,
conditions:
[check-failure=codecov/patch, -closed, -merged, label!=untested-code],
actions: { label: { add: [untested-code] } },
},
{
name: Remove untested-code label,
conditions: [check-success=codecov/patch, label=untested-code],
actions: { label: { remove: [untested-code] } },
},
# Tests
{
name: Add test-failed label,
conditions:
[
check-failure~=(Test on ubuntu-latest with node.js v16|Test on ubuntu-latest with node.js v12|Test on ubuntu-latest with node.js v14|Test on macos-latest with node.js v16|Test on macos-latest with node.js v12|Test on macos-latest with node.js v14|Test on windows-latest with node.js v16|Test on windows-latest with node.js v12|Test on windows-latest with node.js v14),
-closed,
-merged,
label!=test-failed,
],
actions: { label: { add: [test-failed] } },
},
{
name: Remove test-failed label,
conditions:
[
check-success=Test on ubuntu-latest with node.js v16,
check-success=Test on ubuntu-latest with node.js v12,
check-success=Test on ubuntu-latest with node.js v14,
check-success=Test on macos-latest with node.js v16,
check-success=Test on macos-latest with node.js v12,
check-success=Test on macos-latest with node.js v14,
check-success=Test on windows-latest with node.js v16,
check-success=Test on windows-latest with node.js v12,
check-success=Test on windows-latest with node.js v14,
label=test-failed,
],
actions: { label: { remove: [test-failed] } },
},
# Security
{
name: Add security-issue label,
conditions:
[check-failure~=(OSSAR Scan), -closed, -merged, label!=security-issue],
actions: { label: { add: [security-issue] } },
},
{
name: Remove security-issue label,
conditions: [check-success=OSSAR Scan, label=security-issue],
actions: { label: { remove: [security-issue] } },
},
# License
{
name: Add license-issue label,
conditions:
[
check-failure=License Compliance,
-closed,
-merged,
label!=license-issue,
],
actions: { label: { add: [license-issue] } },
},
{
name: Remove license-issue label,
conditions: [check-success=License Compliance, label=license-issue],
actions: { label: { remove: [license-issue] } },
},
# Review
{
name: Remove outdated reviews,
conditions: [base=main, -closed, -merged],
actions: { dismiss_reviews: { approved: true, changes_requested: true } },
},
{
name: Add approved label,
conditions:
[
author!=@ServerlesslyStack/core,
'approved-reviews-by=@ServerlesslyStack/core',
-closed,
-merged,
label!=approved,
],
actions: { label: { add: [approved] } },
},
{
name: Remove approved label,
conditions:
['approved-reviews-by!=@ServerlesslyStack/core', label=approved],
actions: { label: { remove: [approved] } },
},
{
name: Add revision-needed label,
conditions:
[
'#changes-requested-reviews-by>0',
-closed,
-merged,
label!=revision-needed,
],
actions: { label: { add: [revision-needed] } },
},
{
name: Remove revision-needed label,
conditions: ['#changes-requested-reviews-by=0'],
actions: { label: { remove: [revision-needed] } },
},
# Ready to Merge
{
name: Add ready-to-merge label for outsiders,
conditions:
[
author!=@ServerlesslyStack/core,
'author!=dependabot[bot]',
-label~=(pr-title-issue|merge-conflict|revision-needed|blocked|sensitive|forbidden),
label=approved,
check-success=Lint,
check-success=Format Check,
check-success=codeclimate,
check-success=codecov/patch,
check-success=Test on ubuntu-latest with node.js v16,
check-success=Test on ubuntu-latest with node.js v12,
check-success=Test on ubuntu-latest with node.js v14,
check-success=Test on macos-latest with node.js v16,
check-success=Test on macos-latest with node.js v12,
check-success=Test on macos-latest with node.js v14,
check-success=Test on windows-latest with node.js v16,
check-success=Test on windows-latest with node.js v12,
check-success=Test on windows-latest with node.js v14,
check-success=OSSAR Scan,
check-success=License Compliance,
-closed,
-merged,
label!=merge-in-progress,
label!=ready-to-merge,
],
actions: { label: { add: [ready-to-merge] } },
},
{
name: Add ready-to-merge label for dependabot,
conditions:
[
'author=dependabot[bot]',
-label~=(pr-title-issue|merge-conflict|revision-needed|blocked|sensitive|forbidden),
check-success=Lint,
check-success=Format Check,
check-success=codeclimate,
check-success=codecov/patch,
check-success=Test on ubuntu-latest with node.js v16,
check-success=Test on ubuntu-latest with node.js v12,
check-success=Test on ubuntu-latest with node.js v14,
check-success=Test on macos-latest with node.js v16,
check-success=Test on macos-latest with node.js v12,
check-success=Test on macos-latest with node.js v14,
check-success=Test on windows-latest with node.js v16,
check-success=Test on windows-latest with node.js v12,
check-success=Test on windows-latest with node.js v14,
check-success=OSSAR Scan,
check-success=License Compliance,
-closed,
-merged,
label!=merge-in-progress,
label!=ready-to-merge,
],
actions: { label: { add: [ready-to-merge] } },
},
{
name: Add ready-to-merge label for core team,
conditions:
[
author=@ServerlesslyStack/core,
-label~=(pr-title-issue|merge-conflict|revision-needed|blocked|sensitive|forbidden),
check-success=Lint,
check-success=Format Check,
check-success=codeclimate,
check-success=codecov/patch,
check-success=Test on ubuntu-latest with node.js v16,
check-success=Test on ubuntu-latest with node.js v12,
check-success=Test on ubuntu-latest with node.js v14,
check-success=Test on macos-latest with node.js v16,
check-success=Test on macos-latest with node.js v12,
check-success=Test on macos-latest with node.js v14,
check-success=Test on windows-latest with node.js v16,
check-success=Test on windows-latest with node.js v12,
check-success=Test on windows-latest with node.js v14,
check-success=OSSAR Scan,
check-success=License Compliance,
-closed,
-merged,
label!=merge-in-progress,
label!=ready-to-merge,
],
actions: { label: { add: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label upon PR issues,
conditions:
[
label~=(pr-title-issue|merge-conflict|revision-needed|blocked|sensitive|forbidden),
label=ready-to-merge,
],
actions: { label: { remove: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label when PR is not in approved state,
conditions:
[
author!=@ServerlesslyStack/core,
'author!=dependabot[bot]',
label!=approved,
label=ready-to-merge,
],
actions: { label: { remove: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label when Lint check status goes to pending or failure state,
conditions: [check-success!=Lint, label=ready-to-merge],
actions: { label: { remove: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label when Format Check check status goes to pending or failure state,
conditions: [check-success!=Format Check, label=ready-to-merge],
actions: { label: { remove: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label when codeclimate check status goes to pending or failure state,
conditions: [check-success!=codeclimate, label=ready-to-merge],
actions: { label: { remove: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label when codecov/patch check status goes to pending or failure state,
conditions: [check-success!=codecov/patch, label=ready-to-merge],
actions: { label: { remove: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label when Test on ubuntu-latest with node.js v16 check status goes to pending or failure state,
conditions:
[
check-success!=Test on ubuntu-latest with node.js v16,
label=ready-to-merge,
],
actions: { label: { remove: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label when Test on ubuntu-latest with node.js v12 check status goes to pending or failure state,
conditions:
[
check-success!=Test on ubuntu-latest with node.js v12,
label=ready-to-merge,
],
actions: { label: { remove: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label when Test on ubuntu-latest with node.js v14 check status goes to pending or failure state,
conditions:
[
check-success!=Test on ubuntu-latest with node.js v14,
label=ready-to-merge,
],
actions: { label: { remove: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label when Test on macos-latest with node.js v16 check status goes to pending or failure state,
conditions:
[
check-success!=Test on macos-latest with node.js v16,
label=ready-to-merge,
],
actions: { label: { remove: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label when Test on macos-latest with node.js v12 check status goes to pending or failure state,
conditions:
[
check-success!=Test on macos-latest with node.js v12,
label=ready-to-merge,
],
actions: { label: { remove: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label when Test on macos-latest with node.js v14 check status goes to pending or failure state,
conditions:
[
check-success!=Test on macos-latest with node.js v14,
label=ready-to-merge,
],
actions: { label: { remove: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label when Test on windows-latest with node.js v16 check status goes to pending or failure state,
conditions:
[
check-success!=Test on windows-latest with node.js v16,
label=ready-to-merge,
],
actions: { label: { remove: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label when Test on windows-latest with node.js v12 check status goes to pending or failure state,
conditions:
[
check-success!=Test on windows-latest with node.js v12,
label=ready-to-merge,
],
actions: { label: { remove: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label when Test on windows-latest with node.js v14 check status goes to pending or failure state,
conditions:
[
check-success!=Test on windows-latest with node.js v14,
label=ready-to-merge,
],
actions: { label: { remove: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label when OSSAR Scan check status goes to pending or failure state,
conditions: [check-success!=OSSAR Scan, label=ready-to-merge],
actions: { label: { remove: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label when License Compliance check status goes to pending or failure state,
conditions: [check-success!=License Compliance, label=ready-to-merge],
actions: { label: { remove: [ready-to-merge] } },
},
{
name: Remove ready-to-merge label if PR gets closed,
conditions: [closed, label=ready-to-merge],
actions: { label: { remove: [ready-to-merge] } },
},
# Remove WIP
{
name: Request author to remove WIP word from title for PR merge,
conditions:
[
label=ready-to-merge,
label=work-in-progress,
'title~=(?i)wip',
-closed,
-merged,
],
actions:
{
comment:
{
message: 'This Pull Request is ready to be merged. To proceed with the merge, remove `WIP` word from the Pull Request title.',
},
},
},
{
name: Request author to remove Work In Progress word from title for PR merge,
conditions:
[
label=ready-to-merge,
label=work-in-progress,
'title~=(?i)work in progress',
-closed,
-merged,
],
actions:
{
comment:
{
message: 'This Pull Request is ready to be merged. To proceed with the merge, remove `Work in Progress` word from the Pull Request title.',
},
},
},
{
name: Request author to remove construction emoji from title for PR merge,
conditions:
[
label=ready-to-merge,
label=work-in-progress,
'-title~=(?i)wip',
'-title~=(?i)work in progress',
-closed,
-merged,
],
actions:
{
comment:
{
message: 'This Pull Request is ready to be merged. To proceed with the merge, remove :construction: emoji from the Pull Request title.',
},
},
},
# Merge in Progress
{
name: Add merge-in-progress label,
conditions:
[label=ready-to-merge, label!=work-in-progress, -closed, -merged],
actions:
{
label: { add: [merge-in-progress], remove: [ready-to-merge] },
comment:
{
message: 'Automatic merge in progress.. This Pull Request will be updated from {{base}} branch before the merge (do not update manually).',
},
},
},
{
name: Remove merge-in-progress label,
conditions:
[
label~=(pr-title-issue|merge-conflict|revision-needed|blocked|sensitive|forbidden|untested-code|test-failed|security-issue|maintainability-issue|code-style-issue|license-issue),
label=merge-in-progress,
],
actions: { label: { remove: [merge-in-progress] } },
},
# Automatic Merge
{
name: Automatic merge PR of dependabot or outsiders,
conditions:
[
author!=@ServerlesslyStack/core,
label=merge-in-progress,
-label~=(pr-title-issue|merge-conflict|revision-needed|blocked|sensitive|forbidden),
check-success=Lint,
check-success=Format Check,
check-success=codeclimate,
check-success=codecov/patch,
check-success=Test on ubuntu-latest with node.js v16,
check-success=Test on ubuntu-latest with node.js v12,
check-success=Test on ubuntu-latest with node.js v14,
check-success=Test on macos-latest with node.js v16,
check-success=Test on macos-latest with node.js v12,
check-success=Test on macos-latest with node.js v14,
check-success=Test on windows-latest with node.js v16,
check-success=Test on windows-latest with node.js v12,
check-success=Test on windows-latest with node.js v14,
check-success=OSSAR Scan,
check-success=License Compliance,
-closed,
-merged,
],
actions: { merge: { method: squash } },
},
{
name: Automatic merge PR of Core Team without squash label,
conditions:
[
author=@ServerlesslyStack/core,
label!=squash,
label=merge-in-progress,
-label~=(pr-title-issue|merge-conflict|revision-needed|blocked|sensitive|forbidden),
check-success=Lint,
check-success=Format Check,
check-success=codeclimate,
check-success=codecov/patch,
check-success=Test on ubuntu-latest with node.js v16,
check-success=Test on ubuntu-latest with node.js v12,
check-success=Test on ubuntu-latest with node.js v14,
check-success=Test on macos-latest with node.js v16,
check-success=Test on macos-latest with node.js v12,
check-success=Test on macos-latest with node.js v14,
check-success=Test on windows-latest with node.js v16,
check-success=Test on windows-latest with node.js v12,
check-success=Test on windows-latest with node.js v14,
check-success=OSSAR Scan,
check-success=License Compliance,
-closed,
-merged,
],
actions: { merge: { method: merge } },
},
{
name: Automatic merge PR of Core Team with squash label,
conditions:
[
author=@ServerlesslyStack/core,
label=squash,
label=merge-in-progress,
-label~=(pr-title-issue|merge-conflict|revision-needed|blocked|sensitive|forbidden),
check-success=Lint,
check-success=Format Check,
check-success=codeclimate,
check-success=codecov/patch,
check-success=Test on ubuntu-latest with node.js v16,
check-success=Test on ubuntu-latest with node.js v12,
check-success=Test on ubuntu-latest with node.js v14,
check-success=Test on macos-latest with node.js v16,
check-success=Test on macos-latest with node.js v12,
check-success=Test on macos-latest with node.js v14,
check-success=Test on windows-latest with node.js v16,
check-success=Test on windows-latest with node.js v12,
check-success=Test on windows-latest with node.js v14,
check-success=OSSAR Scan,
check-success=License Compliance,
-closed,
-merged,
],
actions: { merge: { method: squash } },
},
# Cleanup
{
name: Cleanup on automatic merge,
conditions: [merged, label=merge-in-progress],
actions:
{
label: { add: [auto-merged], remove: [merge-in-progress] },
comment:
{ message: 'Automatic PR merge successful. :tada: :tada: :tada:' },
},
},
{
name: Cleanup labels on manual merge,
conditions: [merged, label!=merge-in-progress],
actions: { label: { remove: [ready-to-merge, work-in-progress] } },
},
{
name: Thank on successful merge,
conditions:
[author!=@ServerlesslyStack/core, 'author!=dependabot[bot]', merged],
actions:
{
comment:
{
message: 'Thanks for your contribution. These changes will be included in the next release cycle. Keep an eye on [releases page](https://github.com/ServerlesslyStack/Serverlessly/releases).',
},
},
},
{
name: Remove squash label,
conditions: [merged, label=squash],
actions: { label: { remove: [squash] } },
},
{
name: Add rejected label,
conditions: [closed, -merged, label!=rejected],
actions: { label: { add: [rejected] } },
},
{
name: Remove rejected label,
conditions: [-closed, label=rejected],
actions: { label: { remove: [rejected] } },
},
]