Skip to content

Commit 08dad50

Browse files
committed
first commit
0 parents  commit 08dad50

33 files changed

+2541
-0
lines changed

.gitlab-ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
run::cli:
2+
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/golang:1.22.2
3+
rules:
4+
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
5+
script:
6+
- go mod tidy
7+
- go run ./cmd/scm-engine/ evaluate

.scm-engine.example.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# See: https://getbootstrap.com/docs/5.3/customize/color/#all-colors
2+
3+
label:
4+
- name: lang/go
5+
color: "$indigo"
6+
script: merge_request.modified_files("*.go")
7+
8+
- name: lang/markdown
9+
color: "$indigo"
10+
description: "Modified MarkDown files"
11+
script: merge_request.modified_files("*.md")
12+
13+
- name: dependencies/go
14+
color: "$orange"
15+
description: "Updated Go dependency files like go.mod and go.sum"
16+
script: merge_request.modified_files("go.mod", "go.sum")
17+
18+
- name: type/ci
19+
color: "$green"
20+
description: "Modified CI files"
21+
script: merge_request.modified_files(".gitlab-ci.yml") || merge_request.modified_files("build/")
22+
23+
- name: type/deployment
24+
color: "$green"
25+
description: "Modified Deployment files"
26+
script: merge_request.modified_files("_infrastructure/", "scripts/", "configs/")
27+
28+
- name: type/documentation
29+
color: "$green"
30+
description: "Modified Documentation files"
31+
script: merge_request.modified_files("docs/")
32+
33+
- name: type/services
34+
color: "$green"
35+
description: "Modified pkg/services files"
36+
script: merge_request.modified_files("internal/pkg/services")
37+
38+
- name: go::tests::missing
39+
color: "$red"
40+
description: "The Merge Request did NOT modify Go test files"
41+
priority: 999
42+
script: not merge_request.modified_files("*_test.go")
43+
44+
- name: go::tests::OK
45+
color: "$green"
46+
description: "The Merge Request modified Go test files"
47+
priority: 999
48+
script: merge_request.modified_files("*_test.go")
49+
50+
- name: status::age::abandoned
51+
color: "$red"
52+
description: "The most recent commit is older than 45 days"
53+
priority: 999
54+
script: merge_request.time_since_last_commit > duration("45d")
55+
skip_if: merge_request.state in ["merged", "closed", "locked"]
56+
57+
- name: status::age::stale
58+
color: "$red"
59+
description: "The most recent commit is older than 30 days"
60+
priority: 999
61+
script: duration("30d") < merge_request.time_since_last_commit < duration("45d")
62+
skip_if: merge_request.state in ["merged", "closed", "locked"]
63+
64+
- name: status::age::old
65+
color: "$red"
66+
description: "The most recent commit is older than 14 days"
67+
priority: 999
68+
script: duration("14d") < merge_request.time_since_last_commit < duration("30d")
69+
skip_if: merge_request.state in ["merged", "closed", "locked"]
70+
71+
# generate labels for services
72+
#
73+
# internal/service/vault/client.go
74+
# =>
75+
# service/vault
76+
- strategy: generate
77+
description: "Modified this letsgo service directory"
78+
color: "$pink"
79+
script: >
80+
map(merge_request.diff_stats, { .path })
81+
| filter({ hasPrefix(#, "internal/service/") })
82+
| map({ filepath_dir(#) })
83+
| map({ trimPrefix(#, "internal/") })
84+
| uniq()
85+
86+
# generate labels for commands
87+
#
88+
# internal/app/letsgo/subcommands/aws/login/login.go
89+
# =>
90+
# command/aws/login
91+
- strategy: generate
92+
description: "Modified this letsgo command"
93+
color: "$purple"
94+
script: >
95+
map(merge_request.diff_stats, { .path })
96+
| filter({ hasPrefix(#, "internal/app/letsgo/subcommands/") })
97+
| map({ filepath_dir(#) })
98+
| map({ trimPrefix(#, "internal/app/letsgo/subcommands/") })
99+
| map({ string("command/" + #) })
100+
| uniq()

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Christian Winther
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)