|
| 1 | +# This file is used to configure Reviewpad. |
| 2 | +# The configuration is a proposal to help you get started. |
| 3 | +# You can use it as a starting point and customize it to your needs. |
| 4 | +# For more details see https://docs.reviewpad.com/guides/syntax. |
| 5 | + |
| 6 | +# Define the list of labels to be used by Reviewpad. |
| 7 | +# For more details see https://docs.reviewpad.com/guides/syntax#label. |
| 8 | +labels: |
| 9 | + small: |
| 10 | + description: Pull request is small |
| 11 | + color: "#76dbbe" |
| 12 | + medium: |
| 13 | + description: Pull request is medium |
| 14 | + color: "#2986cc" |
| 15 | + large: |
| 16 | + description: Pull request is large |
| 17 | + color: "#c90076" |
| 18 | + |
| 19 | +# Define the list of workflows to be run by Reviewpad. |
| 20 | +# A workflow is a list of actions that will be executed based on the defined rules. |
| 21 | +# For more details see https://docs.reviewpad.com/guides/syntax#workflow. |
| 22 | +workflows: |
| 23 | + # This workflow calls Reviewpad AI agent to summarize the pull request. |
| 24 | + - name: summarize |
| 25 | + description: Summarize the pull request |
| 26 | + run: |
| 27 | + # Summarize the pull request on pull request synchronization. |
| 28 | + - if: ($eventType() == "synchronize" || $eventType() == "opened") && $state() == "open" |
| 29 | + then: $summarize() |
| 30 | + |
| 31 | + # This workflow assigns the most relevant reviewer to pull requests. |
| 32 | + # This helps guarantee that most pull requests are reviewed by at least one person. |
| 33 | + - name: reviewer-assignment |
| 34 | + description: Assign the most relevant reviewer to pull requests |
| 35 | + run: |
| 36 | + # Automatically assign reviewer when the pull request is ready for review; |
| 37 | + - if: $isDraft() == false |
| 38 | + then: $assignCodeAuthorReviewers() |
| 39 | + |
| 40 | + # This workflow praises contributors on their pull request contributions. |
| 41 | + # This helps contributors feel appreciated. |
| 42 | + - name: praise-contributors-on-milestones |
| 43 | + description: Praise contributors based on their contributions |
| 44 | + run: |
| 45 | + # Praise contributors on their first pull request. |
| 46 | + - if: $pullRequestCountBy($author()) == 1 |
| 47 | + then: $commentOnce($sprintf("Thank you @%s for this first contribution!", [$author()])) |
| 48 | + |
| 49 | + # This workflow validates that pull requests follow the conventional commits specification. |
| 50 | + # This helps developers automatically generate changelogs. |
| 51 | + # For more details, see https://www.conventionalcommits.org/en/v1.0.0/. |
| 52 | + - name: check-conventional-commits |
| 53 | + description: Validate that pull requests follow the conventional commits |
| 54 | + run: |
| 55 | + - if: $isDraft() == false |
| 56 | + then: |
| 57 | + # Check commits messages against the conventional commits specification |
| 58 | + - $commitLint() |
| 59 | + # Check pull request title against the conventional commits specification. |
| 60 | + - $titleLint() |
| 61 | + |
| 62 | + # This workflow validates best practices for pull request management. |
| 63 | + # This helps developers follow best practices. |
| 64 | + - name: best-practices |
| 65 | + description: Validate best practices for pull request management |
| 66 | + run: |
| 67 | + # Warn pull requests that do not have an associated GitHub issue. |
| 68 | + - if: $hasLinkedIssues() == false |
| 69 | + then: $warn("Please link an issue to the pull request") |
| 70 | + # Warn pull requests if their description is empty. |
| 71 | + - if: $description() == "" |
| 72 | + then: $warn("Please provide a description for the pull request") |
| 73 | + # Warn pull request do not have a clean linear history. |
| 74 | + - if: $hasLinearHistory() == false |
| 75 | + then: $warn("Please rebase your pull request on the latest changes") |
| 76 | + |
| 77 | + # This workflow labels pull requests based on the total number of lines changed. |
| 78 | + # This helps pick pull requests based on their size and to incentivize small pull requests. |
| 79 | + - name: size-labeling |
| 80 | + description: Label pull request based on the number of lines changed |
| 81 | + run: |
| 82 | + - if: $size() < 100 |
| 83 | + then: $addLabel("small") |
| 84 | + else: $removeLabel("small") |
| 85 | + - if: $size() >= 100 && $size() < 300 |
| 86 | + then: $addLabel("medium") |
| 87 | + else: $removeLabel("medium") |
| 88 | + - if: $size() >= 300 |
| 89 | + then: $addLabel("large") |
| 90 | + else: $removeLabel("large") |
| 91 | + |
| 92 | + # This workflow signals pull requests waiting for reviews. |
| 93 | + # This helps guarantee that pull requests are reviewed and approved by at least one person. |
| 94 | + - name: check-approvals |
| 95 | + description: Check that pull requests have the required number of approvals |
| 96 | + run: |
| 97 | + # Label pull requests with `waiting-for-review` if there are no approvals; |
| 98 | + - if: $isDraft() == false && $approvalsCount() < 1 |
| 99 | + then: $addLabel("waiting-for-review") |
| 100 | + |
| 101 | + # This workflow labels pull requests based on the pull request change type. |
| 102 | + # This helps pick pull requests based on their change type. |
| 103 | + - name: change-type-labelling |
| 104 | + description: Label pull requests based on the type of changes |
| 105 | + run: |
| 106 | + # Label pull requests with `docs` if they only modify Markdown or txt files. |
| 107 | + - if: $hasFileExtensions([".md", ".txt"]) |
| 108 | + then: $addLabel("docs") |
| 109 | + else: $removeLabel("docs") |
| 110 | + # Label pull requests with `infra` if they modify Terraform files. |
| 111 | + - if: $hasFileExtensions([".tf"]) |
| 112 | + then: $addLabel("infra") |
| 113 | + else: $removeLabel("infra") |
| 114 | + # Label pull requests with `dependencies` if they only modify `package.json` and `package.lock` files. |
| 115 | + - if: $hasFileExtensions(["package.json", "package-lock.json"]) |
| 116 | + then: $addLabel("dependencies") |
| 117 | + else: $removeLabel("dependencies") |
| 118 | + |
| 119 | + # This workflow validates that pull requests do not contain changes to the license. |
| 120 | + # This helps avoid unwanted license modifications. |
| 121 | + - name: license-validation |
| 122 | + description: Validate that licenses are not modified |
| 123 | + run: |
| 124 | + # Fail Reviewpad check on pull requests that modify any LICENSE; |
| 125 | + - if: $hasFilePattern("**/LICENSE*") |
| 126 | + then: $fail("License files cannot be modified") |
| 127 | + |
0 commit comments