diff --git a/.cm/best_practices.cm b/.cm/best_practices.cm new file mode 100644 index 0000000..6c26bc6 --- /dev/null +++ b/.cm/best_practices.cm @@ -0,0 +1,41 @@ +# -*- mode: yaml -*- + +manifest: + version: 1.0 + +automations: + best_practices: + if: + - {{ branch.diff.size < 150 }} + - {{ (has.jira_ticket_in_title or has.jira_ticket_in_desc) }} + - {{ branch | estimatedReviewTime < 10 }} + - {{ files | match(regex=r/Standard\/best-practices\//) | every }} + run: + - action: add-label@v1 + args: + label: "🌟 Best Practices 🌟" + color: {{ colors.green }} + - action: add-comment@v1 + args: + comment: "Thank you for following the team's recommended development practices!" + estimated_time_to_review: + if: + - true + run: + - action: add-label@v1 + args: + label: "{{ calc.etr }} min review" + color: {{ colors.red if (calc.etr >= 20) else ( colors.yellow if (calc.etr >= 5) else colors.green ) }} + +calc: + etr: {{ branch | estimatedReviewTime }} + + +colors: + red: 'b60205' + yellow: 'fbca04' + green: '0e8a16' + +has: + jira_ticket_in_title: {{ pr.title | includes(regex=r/\b[A-Za-z]+-\d+\b/) }} + jira_ticket_in_desc: {{ pr.description | includes(regex=r/atlassian.net/) }}