-
Notifications
You must be signed in to change notification settings - Fork 0
/
reviewpad.yml
108 lines (99 loc) · 4.53 KB
/
reviewpad.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
metrics-on-merge: true
extends:
- https://github.com/reviewpad/.github/blob/dev/reviewpad-models/ship-show-ask.yml
# Define the list of labels to be used by Reviewpad.
# For more details see https://docs.reviewpad.com/guides/syntax#label.
labels:
small:
description: Pull request is small
color: "#76dbbe"
medium:
description: Pull request is medium
color: "#2986cc"
large:
description: Pull request is large
color: "#c90076"
# Define the list of workflows to be run by Reviewpad.
# A workflow is a list of actions that will be executed based on the defined rules.
# For more details see https://docs.reviewpad.com/guides/syntax#workflow.
workflows:
# This workflow praises contributors on their pull request contributions.
# This helps contributors feel appreciated.
- name: praise-contributors-on-milestones
description: Praise contributors based on their contributions
run:
# Praise contributors on their first pull request.
- if: $pullRequestCountBy($author()) == 1
then: $commentOnce($sprintf("Thank you @%s for this first contribution!", [$author()]))
# This workflow validates best practices for pull request management.
# This helps developers follow best practices.
- name: best-practices
description: Validate best practices for pull request management
run:
# Warn pull requests that do not have an associated GitHub issue.
- if: $hasLinkedIssues() == false
then: $warn("Please link an issue to the pull request")
# Warn pull requests if their description is empty.
- if: $description() == ""
then: $warn("Please provide a description for the pull request")
# Warn pull request do not have a clean linear history.
- if: $hasLinearHistory() == false
then: $warn("Please rebase your pull request on the latest changes")
# This workflow labels pull requests based on the total number of lines changed.
# This helps pick pull requests based on their size and to incentivize small pull requests.
- name: size-labeling
description: Label pull request based on the number of lines changed
run:
- if: $size() < 100
then: $addLabel("small")
else: $removeLabel("small")
- if: $size() >= 100 && $size() < 300
then: $addLabel("medium")
else: $removeLabel("medium")
- if: $size() >= 300
then: $addLabel("large")
else: $removeLabel("large")
# This workflow labels pull requests based on the pull request change type.
# This helps pick pull requests based on their change type.
- name: change-type-labelling
description: Label pull requests based on the type of changes
run:
# Label pull requests with `docs` if they only modify Markdown or txt files.
- if: $hasFileExtensions([".md", ".txt"])
then: $addLabel("docs")
else: $removeLabel("docs")
# This workflow validates that pull requests do not contain changes to the license.
# This helps avoid unwanted license modifications.
- name: license-validation
description: Validate that licenses are not modified
run:
# Fail Reviewpad check on pull requests that modify any LICENSE;
- if: $hasFilePattern("**/LICENSE*")
then: $fail("License files cannot be modified")
- name: merge strategy ship
trigger: $rule("review-strategy:ship")
stages:
- actions:
- $review("REQUEST_CHANGES", "The pull request has git conflicts. Please fix them.")
until: '!$hasGitConflicts()'
- actions:
- $review("REQUEST_CHANGES", "Pull request is not rebaseable. Please rebase it manually.")
until: $selectFromContext("$.rebaseable") == "true"
- actions:
- $comment("Pull request is not up to date with the base branch. Reviewpad will rebase it.")
- $rebase()
until: $isUpdatedWithBaseBranch() && $hasLinearHistory()
- actions:
- $review("REQUEST_CHANGES", "Some checks are failing. Please fix them.")
until: '!$hasAnyCheckRunCompleted([], ["failure"])'
- actions:
- $info("Reviewpad is waiting for all checks to complete with success.")
until: $haveAllChecksRunCompleted(["reviewpad"], "success", ["Copilot for PRs"])
- actions:
- $comment("The merge is blocked by the label **`do-not-merge`**.")
until: '!$isElementOf("do-not-merge", $labels())'
- actions:
- $assignAssignees([$author()])
- $approve("Pull request is in `ship` mode. Reviewpad will merge it.")
- $merge("squash")
- $deleteHeadBranch()