Skip to content

Commit a147150

Browse files
committed
Infra + gitStream config
1 parent 41afdd3 commit a147150

File tree

9 files changed

+599
-0
lines changed

9 files changed

+599
-0
lines changed

.cm/ai-micro-survey.cm

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# -*- mode: yaml -*-
2+
manifest:
3+
version: 1.0
4+
5+
triggers:
6+
on:
7+
- pr_created
8+
9+
automations:
10+
comment_ai_assistance_prompt:
11+
# Post a comment for all PRs to prompt the PR author to indicate whether they used AI to assist coding in this PR
12+
# Only do this if there's no existing AI-related label and we haven't asked before
13+
if:
14+
- false
15+
# - {{ IS_NOT_A_BOT }}
16+
# - {{ pr.labels | match(regex=r/🤖 ai-*/) | nope }}
17+
# - {{ pr.comments | filter(attr='commenter', term='gitstream-cm') | filter(attr='content', regex=r/Please mark which AI tools you used/) | nope }}
18+
run:
19+
- action: add-comment@v1
20+
args:
21+
comment: |
22+
Please mark which AI tools you used for this PR by checking the appropriate boxes:
23+
24+
- [ ] GitHub Copilot
25+
- [ ] Cursor
26+
- [ ] ChatGPT
27+
- [ ] Tabnine
28+
- [ ] JetBrains AI Assistant
29+
- [ ] VSCode IntelliCode
30+
- [ ] Claude
31+
- [ ] Gemini
32+
- [ ] Other AI tool
33+
- [ ] No AI tools were used
34+
35+
Tip: If you want to avoid this comment in the future, you can add a label of the format `🤖 ai-*` when creating your PR.
36+
37+
IS_NOT_A_BOT: {{ pr.author | match(list=['github-actions', 'dependabot', '[bot]']) | nope }}

.cm/base-kit.cm

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# -*- mode: yaml -*-
2+
manifest:
3+
version: 1.0
4+
5+
triggers:
6+
on:
7+
- pr_created
8+
- commit
9+
- pr_ready_for_review
10+
include:
11+
branch:
12+
- base-kit
13+
14+
automations:
15+
linearb_ai_review:
16+
if:
17+
- {{ not pr.draft }}
18+
- {{ IS_NOT_A_BOT }}
19+
run:
20+
- action: code-review@v1
21+
22+
linearb_ai_description:
23+
if:
24+
- {{ not pr.draft }}
25+
- {{ IS_NOT_A_BOT }}
26+
run:
27+
- action: describe-changes@v1
28+
args:
29+
concat_mode: append
30+
31+
IS_NOT_A_BOT: {{ pr.author | match(list=['github-actions', 'dependabot', '[bot]']) | nope }}

.cm/efficiency-kit.cm

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

.cm/gitstream.cm

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- mode: yaml -*-
2+
manifest:
3+
version: 1.0
4+
5+
triggers:
6+
exclude:
7+
repository:
8+
- linenv
9+
10+
automations:
11+
estimated_time_to_review:
12+
if:
13+
# don't run org-level linearb-ai
14+
- false
15+
# - {{ IS_NOT_A_BOT }}
16+
run:
17+
- action: add-label@v1
18+
args:
19+
label: "{{ calc.etr }} min review"
20+
color: {{ 'E94637' if (calc.etr >= 20) else ('FBBD10' if (calc.etr >= 5) else '36A853') }}
21+
22+
calc:
23+
etr: {{ branch | estimatedReviewTime }}
24+
25+
IS_NOT_A_BOT: {{ pr.author | match(list=['github-actions', 'dependabot', '[bot]']) | nope }}

.cm/linearb-ai.cm

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# -*- mode: yaml -*-
2+
3+
manifest:
4+
version: 1.0
5+
6+
triggers:
7+
on:
8+
- pr_created
9+
- commit
10+
- pr_ready_for_review
11+
exclude:
12+
repository:
13+
- linenv
14+
- linenv-test
15+
- gitstream-automation-demo
16+
17+
automations:
18+
linearb_ai_review:
19+
if:
20+
# don't run org-level linearb-ai
21+
- false
22+
# - {{ not pr.draft }}
23+
# - {{ IS_NOT_A_BOT }}
24+
run:
25+
- action: code-review@v1
26+
args:
27+
approve_on_LGTM: true
28+
29+
linearb_ai_description:
30+
if:
31+
# don't run org-level linearb-ai
32+
- false
33+
# - {{ not pr.draft }}
34+
# - {{ IS_NOT_A_BOT }}
35+
run:
36+
- action: describe-changes@v1
37+
args:
38+
concat_mode: append
39+
40+
IS_NOT_A_BOT: {{ pr.author | match(list=['github-actions', 'dependabot', '[bot]']) | nope }}

.cm/quality-kit.cm

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

0 commit comments

Comments
 (0)