Skip to content

Commit 9511b9a

Browse files
committed
Infra + gitStream config
1 parent 937bc24 commit 9511b9a

File tree

6 files changed

+448
-0
lines changed

6 files changed

+448
-0
lines changed

.cm/efficiency.cm

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# -*- mode: yaml -*-
2+
manifest:
3+
version: 1.0
4+
5+
triggers:
6+
include:
7+
branch:
8+
- code-update-efficiency
9+
10+
automations:
11+
linearb_ai_description:
12+
# trigger it only when PR is created or has new commits
13+
on:
14+
- pr_created
15+
- commit
16+
# skip description for Draft PRs and PRs from bots
17+
if:
18+
- {{ not pr.draft }}
19+
- {{ pr.author | match(list=['github-actions', 'dependabot', '[bot]']) | nope }}
20+
run:
21+
- action: describe-changes@v1
22+
args:
23+
concat_mode: append
24+
25+
label_unresolved_threads:
26+
if:
27+
- {{ pr.unresolved_threads }}
28+
run:
29+
- action: add-label@v1
30+
args:
31+
label: "{{ pr.unresolved_threads }} Unresolved Thread(s)"
32+
color: {{ colors.yellow }}
33+
34+
explain_code_experts:
35+
if:
36+
- true
37+
run:
38+
- action: explain-code-experts@v1
39+
args:
40+
gt: 10
41+
42+
assign_code_experts:
43+
if:
44+
- true
45+
run:
46+
- action: add-reviewers@v1
47+
args:
48+
reviewers: {{ repo | codeExperts(gt=10) }}
49+
50+
linearb_ai_review:
51+
if:
52+
- true
53+
run:
54+
- action: code-review@v1
55+
56+
safe_changes:
57+
# Triggered for any changes that only affect formatting, documentation, tests, or images
58+
if:
59+
- {{ is.formatting or is.docs or is.tests or is.image }}
60+
# Apply a safe change label, approve the PR and explain why in a comment.
61+
run:
62+
- action: add-label@v1
63+
args:
64+
label: 'safe-change'
65+
- action: approve@v1
66+
- action: add-comment@v1
67+
args:
68+
comment: |
69+
This PR is considered a safe change and has been automatically approved.
70+
71+
is:
72+
formatting: {{ source.diff.files | isFormattingChange }}
73+
docs: {{ files | allDocs }}
74+
tests: {{ files | allTests }}
75+
image: {{ files | allImages }}
76+
77+
colors:
78+
yellow: 'fbca04'

.cm/quality.cm

+155
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# -*- mode: yaml -*-
2+
manifest:
3+
version: 1.0
4+
5+
triggers:
6+
include:
7+
branch:
8+
- code-update-quality
9+
10+
automations:
11+
12+
linearb_ai_description:
13+
# trigger it only when PR is created or has new commits
14+
on:
15+
- pr_created
16+
- commit
17+
# skip description for Draft PRs and PRs from bots
18+
if:
19+
- {{ not pr.draft }}
20+
- {{ pr.author | match(list=['github-actions', 'dependabot', '[bot]']) | nope }}
21+
run:
22+
- action: describe-changes@v1
23+
args:
24+
concat_mode: append
25+
26+
explain_code_experts:
27+
if:
28+
- true
29+
run:
30+
- action: explain-code-experts@v1
31+
args:
32+
gt: 10
33+
34+
assign_code_experts:
35+
if:
36+
- true
37+
run:
38+
- action: add-reviewers@v1
39+
args:
40+
reviewers: {{ repo | codeExperts(gt=10) }}
41+
42+
linearb_ai_review:
43+
if:
44+
- true
45+
run:
46+
- action: code-review@v1
47+
48+
label_prs_without_tests:
49+
if:
50+
- {{ files | match(regex=r/[^a-zA-Z0-9](spec|test|tests)[^a-zA-Z0-9]/) | nope }}
51+
run:
52+
- action: add-label@v1
53+
args:
54+
label: 'missing-tests'
55+
color: {{ colors.red }}
56+
57+
label_missing_jira_info:
58+
if:
59+
- {{ not (has.jira_ticket_in_title or has.jira_ticket_in_desc) }}
60+
run:
61+
- action: add-label@v1
62+
args:
63+
label: "missing-jira"
64+
color: {{ colors.red }}
65+
- action: add-comment@v1
66+
args:
67+
comment: |
68+
This PR is missing a Jira ticket reference in the title or description.
69+
Please add a Jira ticket reference to the title or description of this PR.
70+
71+
estimated_time_to_review:
72+
if:
73+
- true
74+
run:
75+
- action: add-label@v1
76+
args:
77+
label: "{{ calc.etr }} min review"
78+
color: {{ colors.red if (calc.etr >= 20) else ( colors.yellow if (calc.etr >= 5) else colors.green ) }}
79+
80+
welcome_newcomer:
81+
# If the PR author made their first contribution on the current day
82+
if:
83+
- true # trigger always for demo purposes
84+
#- {{ repo.author_age < 1 and repo.age > 0 }}
85+
# 1. Add reviewers from the team `my_organization/mentors`. Replace this string to match your organization
86+
# 2. Apply a new-contributor label.
87+
# 3 Post a comment that explains the next steps.
88+
run:
89+
- action: add-reviewers@v1
90+
args:
91+
reviewers: [linear-b/cghyzel]
92+
- action: add-label@v1
93+
args:
94+
label: 'new-contributor'
95+
color: '#FBBD10'
96+
- action : add-comment@v1
97+
args:
98+
comment: |
99+
Hello {{ pr.author }} 👋 Thanks for making your first PR, and welcome to our project!
100+
Our mentor team has automatically been assigned to review this PR and guide you through the process.
101+
Please reach out to that team if you have questions about the next steps.
102+
103+
review_todo_comments:
104+
if:
105+
- {{ source.diff.files | matchDiffLines(regex=r/^[+].*(TODO|todo|FIXME|fixme)/) | some }}
106+
run:
107+
- action: request-changes@v1
108+
args:
109+
comment: |
110+
This PR contains a TODO statement. Please check to see if they should be removed.
111+
112+
review_sensitive_files:
113+
# For all files listed in the sensitive custom expression.
114+
if:
115+
- {{ is.sensitive }}
116+
run:
117+
- action: add-reviewers@v1
118+
args:
119+
reviewers: [linear-b/app-sec]
120+
- action: set-required-approvals@v1
121+
args:
122+
approvals: 2
123+
- action: add-comment@v1
124+
args:
125+
comment: |
126+
This PR affects one or more sensitive files and requires review from the security team.
127+
128+
code_experts:
129+
if:
130+
- true
131+
run:
132+
- action: explain-code-experts@v1
133+
args:
134+
gt: 10
135+
136+
calc:
137+
etr: {{ branch | estimatedReviewTime }}
138+
139+
has:
140+
jira_ticket_in_title: {{ pr.title | includes(regex=r/\b[A-Za-z]+-\d+\b/) }}
141+
jira_ticket_in_desc: {{ pr.description | includes(regex=r/atlassian.net\/browse\/\w{1,}-\d{3,4}/) }}
142+
143+
colors:
144+
red: 'b60205'
145+
yellow: 'fbca04'
146+
green: '0e8a16'
147+
148+
is:
149+
sensitive: {{ files | match(list=sensitive_directories) | some }}
150+
151+
sensitive_directories:
152+
- frontend/
153+
- services/auth-python/app/
154+
- services/billing-csharp/Controllers/
155+
- services/orders-java/src/main/java/

.cm/standardization.cm

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
manifest:
2+
version: 1.0
3+
4+
triggers:
5+
include:
6+
branch:
7+
- code-update-standardization
8+
9+
automations:
10+
11+
# Stage 1
12+
label_missing_jira_info:
13+
if:
14+
- {{ not (has.jira_ticket_in_title or has.jira_ticket_in_desc) }}
15+
run:
16+
- action: add-label@v1
17+
args:
18+
label: "missing-jira"
19+
color: {{ colors.red }}
20+
- action: add-comment@v1
21+
args:
22+
comment: |
23+
This PR is missing a Jira ticket reference in the title or description.
24+
Please add a Jira ticket reference to the title or description of this PR.
25+
26+
linearb_ai_description:
27+
# trigger it only when PR is created or has new commits
28+
on:
29+
- pr_created
30+
- commit
31+
# skip description for Draft PRs and PRs from bots
32+
if:
33+
- {{ not pr.draft }}
34+
- {{ pr.author | match(list=['github-actions', 'dependabot', '[bot]']) | nope }}
35+
run:
36+
- action: describe-changes@v1
37+
args:
38+
concat_mode: append
39+
40+
welcome_newcomer:
41+
# If the PR author made their first contribution on the current day
42+
if:
43+
- true # trigger always for demo purposes
44+
#- {{ repo.author_age < 1 and repo.age > 0 }}
45+
# 1. Add reviewers from the team `my_organization/mentors`. Replace this string to match your organization
46+
# 2. Apply a new-contributor label.
47+
# 3 Post a comment that explains the next steps.
48+
run:
49+
- action: add-reviewers@v1
50+
args:
51+
reviewers: [linear-b/cghyzel]
52+
- action: add-label@v1
53+
args:
54+
label: 'new-contributor'
55+
color: '#FBBD10'
56+
- action : add-comment@v1
57+
args:
58+
comment: |
59+
Hello {{ pr.author }} 👋 Thanks for making your first PR, and welcome to our project!
60+
Our mentor team has automatically been assigned to review this PR and guide you through the process.
61+
Please reach out to that team if you have questions about the next steps.
62+
63+
linearb_ai_review:
64+
if:
65+
- true
66+
run:
67+
- action: code-review@v1
68+
69+
request_screenshot:
70+
# Triggered for PRs that lack an image file or link to an image in the PR description
71+
if:
72+
- {{ files | match(list=['frontend']) | some }}
73+
- {{ not (has.screenshot_link or has.image_uploaded) }}
74+
run:
75+
- action: add-label@v1
76+
args:
77+
label: 'no-screenshot'
78+
color: '#FF000A'
79+
- action: add-comment@v1
80+
args:
81+
comment: |
82+
Be a life saver 🛟 by adding a screenshot of the changes you made.
83+
84+
estimated_time_to_review:
85+
if:
86+
- true
87+
run:
88+
- action: add-label@v1
89+
args:
90+
label: "{{ calc.etr }} min review"
91+
color: {{ colors.red if (calc.etr >= 20) else ( colors.yellow if (calc.etr >= 5) else colors.green ) }}
92+
93+
review_todo_comments:
94+
if:
95+
- {{ source.diff.files | matchDiffLines(regex=r/^[+].*(TODO|todo|FIXME|fixme)/) | some }}
96+
run:
97+
- action: request-changes@v1
98+
args:
99+
comment: |
100+
This PR contains a TODO statement. Please check to see if they should be removed.
101+
102+
explain_code_experts:
103+
if:
104+
- true
105+
run:
106+
- action: explain-code-experts@v1
107+
args:
108+
gt: 10
109+
110+
# Stage 2
111+
assign_code_experts:
112+
if:
113+
- true
114+
run:
115+
- action: add-reviewers@v1
116+
args:
117+
reviewers: {{ repo | codeExperts(gt=10) }}
118+
119+
has:
120+
screenshot_link: {{ pr.description | includes(regex=r/!\[.*\]\(.*(jpg|svg|png|gif|psd).*\)/) }}
121+
image_uploaded: {{ pr.description | includes(regex=r/<img.*src.*(jpg|svg|png|gif|psd).*>/) }}
122+
jira_ticket_in_title: {{ pr.title | includes(regex=r/\b[A-Za-z]+-\d+\b/) }}
123+
jira_ticket_in_desc: {{ pr.description | includes(regex=r/atlassian.net\/browse\/\w{1,}-\d{3,4}/) }}
124+
125+
calc:
126+
etr: {{ branch | estimatedReviewTime }}

0 commit comments

Comments
 (0)