|
| 1 | +# -*- mode: yaml -*- |
| 2 | +# This example configuration for provides basic automations to get started with gitStream. |
| 3 | +# View the gitStream quickstart for more examples: https://docs.gitstream.cm/examples/ |
| 4 | +manifest: |
| 5 | + version: 1.0 |
| 6 | + |
| 7 | + |
| 8 | +triggers: |
| 9 | + exclude: |
| 10 | + branch: |
| 11 | + - l10n_dev |
| 12 | + - dev |
| 13 | + |
| 14 | + |
| 15 | +automations: |
| 16 | + # Add a label that indicates how many minutes it will take to review the PR. |
| 17 | + estimated_time_to_review: |
| 18 | + if: |
| 19 | + - true |
| 20 | + run: |
| 21 | + - action: add-label@v1 |
| 22 | + args: |
| 23 | + label: "{{ calc.etr }} min review" |
| 24 | + color: {{ colors.red if (calc.etr >= 20) else ( colors.yellow if (calc.etr >= 5) else colors.green ) }} |
| 25 | + # Post a comment that lists the best experts for the files that were modified. |
| 26 | + explain_code_experts: |
| 27 | + if: |
| 28 | + - true |
| 29 | + run: |
| 30 | + - action: explain-code-experts@v1 |
| 31 | + args: |
| 32 | + gt: 10 |
| 33 | + # Post a comment notifying that the PR contains a TODO statement. |
| 34 | + review_todo_comments: |
| 35 | + if: |
| 36 | + - {{ source.diff.files | matchDiffLines(regex=r/^[+].*\b(TODO|todo)\b/) | some }} |
| 37 | + run: |
| 38 | + - action: add-comment@v1 |
| 39 | + args: |
| 40 | + comment: | |
| 41 | + This PR contains a TODO statement. Please check to see if they should be removed. |
| 42 | + # Post a comment that request a before and after screenshot |
| 43 | + request_screenshot: |
| 44 | + # Triggered for PRs that lack an image file or link to an image in the PR description |
| 45 | + if: |
| 46 | + - {{ not (has.screenshot_link or has.image_uploaded) }} |
| 47 | + run: |
| 48 | + - action: add-comment@v1 |
| 49 | + args: |
| 50 | + comment: | |
| 51 | + Be a legend :trophy: by adding a before and after screenshot of the changes you made, especially if they are around UI/UX. |
| 52 | +
|
| 53 | +
|
| 54 | +# +----------------------------------------------------------------------------+ |
| 55 | +# | Custom Expressions | |
| 56 | +# | https://docs.gitstream.cm/how-it-works/#custom-expressions | |
| 57 | +# +----------------------------------------------------------------------------+ |
| 58 | + |
| 59 | +calc: |
| 60 | + etr: {{ branch | estimatedReviewTime }} |
| 61 | + |
| 62 | +colors: |
| 63 | + red: 'b60205' |
| 64 | + yellow: 'fbca04' |
| 65 | + green: '0e8a16' |
| 66 | + |
| 67 | +changes: |
| 68 | + # Sum all the lines added/edited in the PR |
| 69 | + additions: {{ branch.diff.files_metadata | map(attr='additions') | sum }} |
| 70 | + # Sum all the line removed in the PR |
| 71 | + deletions: {{ branch.diff.files_metadata | map(attr='deletions') | sum }} |
| 72 | + # Calculate the ratio of new code |
| 73 | + ratio: {{ (changes.additions / (changes.additions + changes.deletions)) * 100 | round(2) }} |
| 74 | + |
| 75 | +has: |
| 76 | + screenshot_link: {{ pr.description | includes(regex=r/!\[.*\]\(.*(jpg|svg|png|gif|psd).*\)/) }} |
| 77 | + image_uploaded: {{ pr.description | includes(regex=r/(<img.*src.*(jpg|svg|png|gif|psd).*>)|!\[image\]\(.*github\.com.*\)/) }} |
0 commit comments