diff --git a/.cm/approve-safe-changes.cm b/.cm/approve-safe-changes.cm new file mode 100644 index 0000000..52bab11 --- /dev/null +++ b/.cm/approve-safe-changes.cm @@ -0,0 +1,23 @@ +# -*- mode: yaml -*- + +manifest: + version: 1.0 + +automations: + safe_changes: + if: + - {{ is.formatting or is.docs or is.tests or is.asset }} + run: + - action: add-label@v1 + args: + label: 'safe-changes' + - action: approve@v1 + +# To simplify the automation, this calculation is placed under a unique YAML key. +# The result is is assigned to `is.formatting`, `is.docs` and `is.tests` which is +# used in the automation above. You can add as many keys as you like. +is: + formatting: {{ source.diff.files | isFormattingChange }} + docs: {{ files | allDocs }} + tests: {{ files | allTests }} + asset: {{ files | match(regex=r/\.(png|svg|gif|css)$/) | every }} diff --git a/.cm/assign-the-relevant-reviewers-to-prs.cm b/.cm/assign-the-relevant-reviewers-to-prs.cm new file mode 100644 index 0000000..161d644 --- /dev/null +++ b/.cm/assign-the-relevant-reviewers-to-prs.cm @@ -0,0 +1,17 @@ +# -*- mode: yaml -*- + +manifest: + version: 1.0 + +automations: + the_right_reviewer: + if: + - true + run: + - action: add-comment@v1 + args: + comment: | + {{ repo | explainRankByGitBlame(gt=25) }} + - action: add-reviewers@v1 + args: + reviewers: {{ repo | rankByGitBlame(gt=25) | random }} \ No newline at end of file diff --git a/.cm/label-prs-by-complexity.cm b/.cm/label-prs-by-complexity.cm new file mode 100644 index 0000000..5776be0 --- /dev/null +++ b/.cm/label-prs-by-complexity.cm @@ -0,0 +1,20 @@ +# -*- mode: yaml -*- + +manifest: + version: 1.0 + +automations: + estimated_time_to_review: + if: + - true + run: + - action: add-label@v1 + args: + label: "{{ calc.etr }} min review" + color: {{ 'E94637' if (calc.etr >= 20) else ('FBBD10' if (calc.etr >= 5) else '36A853') }} + +# To simplify the automation, this calculation is placed under a unique YAML key. +# The result is assigned to `calc.etr` which is used in the automation above. +# You can add as many keys as you like. +calc: + etr: {{ branch | estimatedReviewTime }} \ No newline at end of file diff --git a/.cm/mark-prs-with-deleted-files.cm b/.cm/mark-prs-with-deleted-files.cm new file mode 100644 index 0000000..ff7508f --- /dev/null +++ b/.cm/mark-prs-with-deleted-files.cm @@ -0,0 +1,17 @@ +# -*- mode: yaml -*- + +manifest: + version: 1.0 + +automations: + deleted: + if: + - {{ has.deleted_files }} + run: + - action: add-label@v1 + args: + label: 'deleted-files' + color: '#DF9C04' + +has: + deleted_files: {{ source.diff.files | map(attr='new_file') | match(term='/dev/null') | some }} diff --git a/.cm/mark-prs-without-tests.cm b/.cm/mark-prs-without-tests.cm new file mode 100644 index 0000000..0908197 --- /dev/null +++ b/.cm/mark-prs-without-tests.cm @@ -0,0 +1,14 @@ +# -*- mode: yaml -*- + +manifest: + version: 1.0 + +automations: + no_tests: + if: + - {{ files | match(regex=r/(test|spec)/) | nope }} + run: + - action: add-label@v1 + args: + label: 'missing-tests' + color: '#E94637' \ No newline at end of file diff --git a/.cm/more-approvals-for-complex-changes.cm b/.cm/more-approvals-for-complex-changes.cm new file mode 100644 index 0000000..dd83039 --- /dev/null +++ b/.cm/more-approvals-for-complex-changes.cm @@ -0,0 +1,15 @@ +# -*- mode: yaml -*- + +manifest: + version: 1.0 + +automations: + double_review: + if: + - {{ branch | estimatedReviewTime >= 30 }} + - {{ files | length >= 10 }} + - {{ files | match(regex=r/src\//) | some }} + run: + - action: set-required-approvals@v1 + args: + approvals: 2 \ No newline at end of file