2020-01-10 10:05:31 +00:00
|
|
|
#
|
|
|
|
# Copyright (c) 2020, Arm Limited and affiliates.
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
# Mergify follow our workflow: https://os.mbed.com/docs/mbed-os/latest/contributing/workflow.html
|
|
|
|
# Inital state (needs: review) is done by internal reviewer bot
|
|
|
|
|
|
|
|
# Notes: conditions do not check if label is already there if we add or remove later, this is to limit Github API access to
|
|
|
|
# minimum. If a label is already there and we add it again, nothing should happen (we do 1 less access to Github).
|
2020-01-16 11:14:08 +00:00
|
|
|
# For instance for needs: work if CI failed, we just add a label as action, don't check if needs: works is already there.
|
|
|
|
#
|
|
|
|
# Reviewers request needs write access to block PR, otherwise it's just a suggestion on Github, not PR block
|
2020-01-10 10:05:31 +00:00
|
|
|
|
|
|
|
pull_request_rules:
|
|
|
|
# From needs: review to needs: work - reviewers request
|
|
|
|
- name: "label needs: work when changes were requested"
|
|
|
|
conditions:
|
|
|
|
# Reviewers
|
|
|
|
- "#changes-requested-reviews-by>0"
|
|
|
|
actions:
|
|
|
|
label:
|
2020-01-21 13:02:48 +00:00
|
|
|
add: ['needs: work']
|
2020-01-21 13:11:38 +00:00
|
|
|
remove: ['needs: review', 'needs: CI']
|
2020-01-10 10:05:31 +00:00
|
|
|
|
|
|
|
# From needs: review to needs: work - CI failure
|
|
|
|
- name: "label needs: work when travis-ci failed"
|
|
|
|
conditions:
|
|
|
|
# Travis failing
|
|
|
|
- status-failure~=continuous-integration/travis-ci/pr
|
|
|
|
actions:
|
|
|
|
label:
|
2020-01-21 13:02:48 +00:00
|
|
|
add: ['needs: work']
|
2020-01-21 13:11:38 +00:00
|
|
|
remove: ['needs: review', 'needs: CI']
|
2020-01-10 10:05:31 +00:00
|
|
|
|
|
|
|
# From needs: review to needs: work - CI failure
|
|
|
|
- name: "label needs: work when Jenkins CI failed - pr head"
|
|
|
|
conditions:
|
|
|
|
# Jenkins CI failing
|
|
|
|
- status-failure~=continuous-integration/jenkins/pr-head
|
|
|
|
actions:
|
|
|
|
label:
|
2020-01-21 13:02:48 +00:00
|
|
|
add: ['needs: work']
|
2020-01-21 13:11:38 +00:00
|
|
|
remove: ['needs: review','needs: CI']
|
2020-01-10 10:05:31 +00:00
|
|
|
|
|
|
|
# From needs: review to needs: work - CI failure
|
|
|
|
- name: "label needs: work when Jenkins CI failed - any of the pipeline"
|
|
|
|
conditions:
|
|
|
|
# Jenkins CI failing - any of the pipeline
|
|
|
|
- status-failure~=^jenkins-ci
|
|
|
|
actions:
|
|
|
|
label:
|
2020-01-21 13:02:48 +00:00
|
|
|
add: ['needs: work']
|
2020-01-21 13:11:38 +00:00
|
|
|
remove: ['needs: review', 'needs: CI']
|
2020-01-10 10:05:31 +00:00
|
|
|
|
2020-01-16 14:15:39 +00:00
|
|
|
# From needs: review or needs: work to needs: CI. One approval means we should be good to start CI
|
2020-01-10 10:05:31 +00:00
|
|
|
- name: "label needs: CI when at least one reviewers approval"
|
|
|
|
conditions:
|
|
|
|
# Labels
|
|
|
|
- "label!=needs: preceding PR"
|
|
|
|
|
|
|
|
# Reviewers
|
|
|
|
- "#changes-requested-reviews-by=0"
|
|
|
|
- "#approved-reviews-by>=1"
|
|
|
|
|
|
|
|
# CI green policy, at least Travis should be green
|
|
|
|
- status-success~=continuous-integration/travis-ci/pr
|
2020-01-16 14:27:38 +00:00
|
|
|
# new CI needs to be done (neutral does not work, lets check if it failed or passed, if none, we need to run again)
|
|
|
|
- -status-success~=continuous-integration/jenkins/pr-head
|
|
|
|
- -status-failure~=continuous-integration/jenkins/pr-head
|
2020-01-10 10:05:31 +00:00
|
|
|
actions:
|
|
|
|
label:
|
2020-01-21 13:02:48 +00:00
|
|
|
add: ['needs: CI']
|
2020-01-21 12:31:58 +00:00
|
|
|
remove: ['needs: review', 'needs: work']
|
2020-01-10 10:05:31 +00:00
|
|
|
|
2020-01-20 14:41:02 +00:00
|
|
|
# Remove reviews after the branch is updated. This yet does not allow
|
|
|
|
# any other action like labels, etc. See mergify-engine/issues/360
|
|
|
|
- name: remove outdated reviews
|
|
|
|
conditions: []
|
|
|
|
actions:
|
|
|
|
dismiss_reviews:
|
|
|
|
approved: True
|
|
|
|
changes_requested: True
|
|
|
|
|
2020-01-10 10:05:31 +00:00
|
|
|
# Conflict in the PR - needs: work and a comment to notify a user
|
|
|
|
- name: "label needs: work when there is a conflict"
|
|
|
|
conditions:
|
|
|
|
- conflict
|
|
|
|
actions:
|
|
|
|
label:
|
2020-01-21 13:02:48 +00:00
|
|
|
add: ['needs: work']
|
2020-01-21 12:31:58 +00:00
|
|
|
remove: ['needs: review', 'needs: CI']
|
|
|
|
|
2020-01-10 10:05:31 +00:00
|
|
|
comment:
|
|
|
|
message: This PR cannot be merged due to conflicts. Please rebase to resolve them.
|
|
|
|
|
|
|
|
- name: "add label feature branch for feature branch additions"
|
|
|
|
conditions:
|
|
|
|
- base~=^feature
|
|
|
|
actions:
|
|
|
|
label:
|
2020-01-21 13:02:48 +00:00
|
|
|
add: ['release-version: feature branch']
|
2020-01-10 10:05:31 +00:00
|
|
|
|
|
|
|
# Ready for integration. Not yet auto merge, will be enabled once carefuly tested
|
|
|
|
- name: label "ready for merge" when ready
|
|
|
|
conditions:
|
|
|
|
# Labels
|
2020-01-16 12:21:58 +00:00
|
|
|
- "label!=do not merge"
|
2020-01-10 10:05:31 +00:00
|
|
|
- "label=needs: CI"
|
|
|
|
|
|
|
|
# Reviewers
|
|
|
|
- "#approved-reviews-by>=1"
|
|
|
|
- "#changes-requested-reviews-by=0"
|
|
|
|
|
|
|
|
# CI green policy
|
|
|
|
- status-success~=continuous-integration/travis-ci/pr
|
|
|
|
# Internal Jenkins - we rely on PR head to provide status
|
|
|
|
- status-success~=continuous-integration/jenkins/pr-head
|
2020-01-16 15:13:01 +00:00
|
|
|
# any of the jenkins pipeline needs to be green. We rely on not failure means all good (if skipped or executed)
|
2020-01-16 14:52:00 +00:00
|
|
|
- -status-failure~=^jenkins-ci
|
2020-01-10 10:05:31 +00:00
|
|
|
actions:
|
|
|
|
label:
|
2020-01-21 13:02:48 +00:00
|
|
|
add: ['ready for merge']
|
|
|
|
remove: ['needs: CI']
|
2020-01-10 10:05:31 +00:00
|
|
|
|
|
|
|
# Clean-up after merge
|
|
|
|
- name: remove ready for merge when merged
|
|
|
|
conditions:
|
|
|
|
- merged
|
2020-01-16 12:21:58 +00:00
|
|
|
- "label=ready for merge"
|
2020-01-10 10:05:31 +00:00
|
|
|
actions:
|
|
|
|
label:
|
2020-01-21 13:02:48 +00:00
|
|
|
remove: ['ready for merge']
|
2020-01-10 10:05:31 +00:00
|
|
|
|
|
|
|
- name: add "do not merge" label when WIP is in title
|
|
|
|
conditions:
|
|
|
|
- title~=^(\[wip\]( |:) |\[WIP\]( |:) |wip( |:) |WIP( |:)).*
|
|
|
|
actions:
|
|
|
|
label:
|
2020-01-21 13:02:48 +00:00
|
|
|
add: ['do not merge']
|
2020-01-10 10:05:31 +00:00
|
|
|
|
|
|
|
# Check if version label is applied
|
|
|
|
- name: release version is a must for merged PRs
|
|
|
|
conditions:
|
|
|
|
- merged
|
|
|
|
- -label~=^(release-version)
|
2020-02-04 13:36:35 +00:00
|
|
|
- -label~=^(Release review required)
|
2020-01-10 10:05:31 +00:00
|
|
|
actions:
|
|
|
|
label:
|
2020-02-04 13:36:35 +00:00
|
|
|
add: ['release version missing']
|
2020-01-10 10:05:31 +00:00
|
|
|
comment:
|
|
|
|
message: This PR does not contain release version label after merging.
|
|
|
|
|
|
|
|
|