Skip to content

Commit 28e22bd

Browse files
authored
Merge branch 'main' into highlight-tags-attr-proj
2 parents eb9f185 + d711353 commit 28e22bd

File tree

8 files changed

+77
-174
lines changed

8 files changed

+77
-174
lines changed

.github/workflows/test.yml

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,29 @@ jobs:
3333
runs-on: ubuntu-latest
3434
timeout-minutes: 5
3535
steps:
36-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
37-
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
36+
- uses: actions/checkout@v5
37+
- uses: actions/setup-go@v6
3838
with:
3939
go-version-file: "go.mod"
4040
cache: true
4141
- run: go mod download
4242
- run: go build -v .
4343
- name: Run linters
44-
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
44+
uses: golangci/golangci-lint-action@v8
4545
with:
4646
version: latest
4747

4848
generate:
4949
runs-on: ubuntu-latest
5050
steps:
51-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
52-
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
51+
- uses: actions/checkout@v5
52+
- uses: actions/setup-go@v6
5353
with:
5454
go-version-file: "go.mod"
5555
cache: true
5656
- name: Install uv
57-
uses: astral-sh/setup-uv@v6
58-
# We need the latest version of Terraform for our documentation generation to use
59-
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
57+
uses: astral-sh/setup-uv@v7
58+
- uses: hashicorp/setup-terraform@v3
6059
with:
6160
terraform_wrapper: false
6261
- run: make generate
@@ -76,36 +75,14 @@ jobs:
7675
max-parallel: 1
7776
matrix:
7877
terraform:
79-
- "1.4.*"
80-
- "1.5.*"
81-
- "1.6.*"
82-
- "1.7.*"
83-
- "1.8.*"
84-
- "1.9.*"
85-
- "1.10.*"
86-
is-pr:
87-
- ${{ github.event_name == 'pull_request' }}
88-
# Only run the latest version of Terraform on pull requests
89-
exclude:
90-
- terraform: "1.4.*"
91-
is-pr: true
92-
- terraform: "1.5.*"
93-
is-pr: true
94-
- terraform: "1.6.*"
95-
is-pr: true
96-
- terraform: "1.7.*"
97-
is-pr: true
98-
- terraform: "1.8.*"
99-
is-pr: true
100-
- terraform: "1.9.*"
101-
is-pr: true
78+
- "1.13.*"
10279
steps:
103-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
104-
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
80+
- uses: actions/checkout@v5
81+
- uses: actions/setup-go@v6
10582
with:
10683
go-version-file: "go.mod"
10784
cache: true
108-
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
85+
- uses: hashicorp/setup-terraform@v3
10986
with:
11087
terraform_version: ${{ matrix.terraform }}
11188
terraform_wrapper: false

.github/workflows/update-sentrydata.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
go-version-file: "go.mod"
2020
cache: true
2121
- name: Install uv
22-
uses: astral-sh/setup-uv@v6
22+
uses: astral-sh/setup-uv@v7
2323
- uses: hashicorp/setup-terraform@v3
2424
with:
2525
terraform_wrapper: false
@@ -30,7 +30,6 @@ jobs:
3030
- name: Create Pull Request
3131
uses: peter-evans/create-pull-request@v7
3232
with:
33-
token: ${{ secrets.GITHUB_TOKEN }}
3433
branch: update-sentry-data
3534
commit-message: Update Sentry data
3635
title: Update Sentry data

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,7 @@ website/vendor
3939
*.winfile eol=crlf
4040

4141
# virtualenv
42-
.venv
42+
.venv
43+
44+
.env
45+
.envrc

.tool-versions

Lines changed: 0 additions & 1 deletion
This file was deleted.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/jianyuan/terraform-provider-sentry
22

3-
go 1.23.5
3+
go 1.25.3
44

55
require (
66
github.com/google/go-cmp v0.7.0

go.sum

Lines changed: 28 additions & 92 deletions
Large diffs are not rendered by default.

internal/sentrydata/generate.py

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import httpx
99
import jinja2
1010

11+
REPO = "getsentry/sentry"
12+
BRANCH = "master"
1113
TEMPLATE = """package sentrydata
1214
1315
{% for key, value in result.items() %}
@@ -46,33 +48,20 @@ def is_list(value: Any) -> TypeGuard[list[Any]]:
4648

4749
def get_text(path: str) -> str:
4850
r = httpx.get(
49-
f"https://raw.githubusercontent.com/getsentry/sentry/refs/heads/master/{path}"
51+
f"https://raw.githubusercontent.com/{REPO}/refs/heads/{BRANCH}/{path}"
5052
)
5153
r.raise_for_status()
5254
return r.text
5355

5456

55-
class GitHubUrl(str):
56-
def for_stmt(self, stmt: ast.stmt) -> GitHubUrl:
57-
return self.lineno(stmt.lineno).end_lineno(stmt.end_lineno)
58-
59-
def lineno(self, lineno: int) -> GitHubUrl:
60-
return GitHubUrl(f"{self}#L{lineno}")
61-
62-
def end_lineno(self, lineno: int | None) -> GitHubUrl:
63-
if lineno is None:
64-
return self
65-
return GitHubUrl(f"{self}-L{lineno}")
66-
67-
6857
class FileData(NamedTuple):
69-
github_url: GitHubUrl
58+
github_url: str
7059
tree: ast.Module
7160

7261

7362
def get_file_data(path: str) -> FileData:
7463
return FileData(
75-
github_url=GitHubUrl(f"https://github.com/getsentry/sentry/blob/master/{path}"),
64+
github_url=f"https://github.com/{REPO}/blob/{BRANCH}/{path}",
7665
tree=ast.parse(get_text(path)),
7766
)
7867

@@ -97,15 +86,15 @@ def parse_constants() -> dict[str, ResultData[Any]]:
9786
value=ast.Dict(keys=keys, values=values),
9887
):
9988
out["LogLevels"] = ResultData(
100-
github_url=data.github_url.for_stmt(node),
89+
github_url=data.github_url,
10190
result=[],
10291
)
10392
out["LogLevelNameToId"] = ResultData(
104-
github_url=data.github_url.for_stmt(node),
93+
github_url=data.github_url,
10594
result=OrderedDict(),
10695
)
10796
out["LogLevelIdToName"] = ResultData(
108-
github_url=data.github_url.for_stmt(node),
97+
github_url=data.github_url,
10998
result=OrderedDict(),
11099
)
111100
for key, value in zip(keys, values):
@@ -127,15 +116,15 @@ def parse_issues_grouptype() -> dict[str, ResultData[Any]]:
127116
match node:
128117
case ast.ClassDef(name="GroupCategory", body=body):
129118
out["IssueGroupCategories"] = ResultData(
130-
github_url=data.github_url.for_stmt(node),
119+
github_url=data.github_url,
131120
result=[],
132121
)
133122
out["IssueGroupCategoryNameToId"] = ResultData(
134-
github_url=data.github_url.for_stmt(node),
123+
github_url=data.github_url,
135124
result=OrderedDict(),
136125
)
137126
out["IssueGroupCategoryIdToName"] = ResultData(
138-
github_url=data.github_url.for_stmt(node),
127+
github_url=data.github_url,
139128
result=OrderedDict(),
140129
)
141130
for node in body:
@@ -167,7 +156,7 @@ def parse_rules_conditions_event_attribute() -> dict[str, ResultData[Any]]:
167156
value=ast.Dict(keys=keys),
168157
):
169158
out["EventAttributes"] = ResultData(
170-
github_url=data.github_url.for_stmt(node),
159+
github_url=data.github_url,
171160
result=[],
172161
)
173162
for key in keys:
@@ -185,15 +174,15 @@ def parse_rules_match() -> dict[str, ResultData[Any]]:
185174
match node:
186175
case ast.ClassDef(name="MatchType", body=body):
187176
out["MatchTypes"] = ResultData(
188-
github_url=data.github_url.for_stmt(node),
177+
github_url=data.github_url,
189178
result=[],
190179
)
191180
out["MatchTypeNameToId"] = ResultData(
192-
github_url=data.github_url.for_stmt(node),
181+
github_url=data.github_url,
193182
result=OrderedDict(),
194183
)
195184
out["MatchTypeIdToName"] = ResultData(
196-
github_url=data.github_url.for_stmt(node),
185+
github_url=data.github_url,
197186
result=OrderedDict(),
198187
)
199188
for node in body:
@@ -214,7 +203,7 @@ def parse_rules_match() -> dict[str, ResultData[Any]]:
214203
value=ast.Dict(keys=keys),
215204
):
216205
out["LevelMatchTypes"] = ResultData(
217-
github_url=data.github_url.for_stmt(node),
206+
github_url=data.github_url,
218207
result=[],
219208
)
220209
for key in keys:
@@ -254,7 +243,7 @@ def extract_types(classdef: ast.ClassDef) -> list[str]:
254243
types = extract_types(node)
255244
if types:
256245
out[name] = ResultData(
257-
github_url=data.github_url.for_stmt(node),
246+
github_url=data.github_url,
258247
result=types,
259248
)
260249
case _:
@@ -272,7 +261,7 @@ def parse_models_project() -> dict[str, ResultData[Any]]:
272261
value=ast.List(elts=elts),
273262
):
274263
out["Platforms"] = ResultData(
275-
github_url=data.github_url.for_stmt(node),
264+
github_url=data.github_url,
276265
result=["other"],
277266
)
278267
for elt in elts:

internal/sentrydata/sentrydata.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package sentrydata
22

3-
// https://github.com/getsentry/sentry/blob/master/src/sentry/constants.py#L246-L253
3+
// https://github.com/getsentry/sentry/blob/master/src/sentry/constants.py
44
var LogLevels = []string{
55
"sample",
66
"debug",
@@ -10,7 +10,7 @@ var LogLevels = []string{
1010
"fatal",
1111
}
1212

13-
// https://github.com/getsentry/sentry/blob/master/src/sentry/constants.py#L246-L253
13+
// https://github.com/getsentry/sentry/blob/master/src/sentry/constants.py
1414
var LogLevelNameToId = map[string]string{
1515
"sample": "0",
1616
"debug": "10",
@@ -20,7 +20,7 @@ var LogLevelNameToId = map[string]string{
2020
"fatal": "50",
2121
}
2222

23-
// https://github.com/getsentry/sentry/blob/master/src/sentry/constants.py#L246-L253
23+
// https://github.com/getsentry/sentry/blob/master/src/sentry/constants.py
2424
var LogLevelIdToName = map[string]string{
2525
"0": "sample",
2626
"10": "debug",
@@ -30,7 +30,7 @@ var LogLevelIdToName = map[string]string{
3030
"50": "fatal",
3131
}
3232

33-
// https://github.com/getsentry/sentry/blob/master/src/sentry/issues/grouptype.py#L30-L67
33+
// https://github.com/getsentry/sentry/blob/master/src/sentry/issues/grouptype.py
3434
var IssueGroupCategories = []string{
3535
"Error",
3636
"Performance",
@@ -49,7 +49,7 @@ var IssueGroupCategories = []string{
4949
"Mobile",
5050
}
5151

52-
// https://github.com/getsentry/sentry/blob/master/src/sentry/issues/grouptype.py#L30-L67
52+
// https://github.com/getsentry/sentry/blob/master/src/sentry/issues/grouptype.py
5353
var IssueGroupCategoryNameToId = map[string]string{
5454
"Error": "1",
5555
"Performance": "2",
@@ -68,7 +68,7 @@ var IssueGroupCategoryNameToId = map[string]string{
6868
"Mobile": "15",
6969
}
7070

71-
// https://github.com/getsentry/sentry/blob/master/src/sentry/issues/grouptype.py#L30-L67
71+
// https://github.com/getsentry/sentry/blob/master/src/sentry/issues/grouptype.py
7272
var IssueGroupCategoryIdToName = map[string]string{
7373
"1": "Error",
7474
"2": "Performance",
@@ -87,7 +87,7 @@ var IssueGroupCategoryIdToName = map[string]string{
8787
"15": "Mobile",
8888
}
8989

90-
// https://github.com/getsentry/sentry/blob/master/src/sentry/rules/conditions/event_attribute.py#L41-L72
90+
// https://github.com/getsentry/sentry/blob/master/src/sentry/rules/conditions/event_attribute.py
9191
var EventAttributes = []string{
9292
"message",
9393
"platform",
@@ -121,7 +121,7 @@ var EventAttributes = []string{
121121
"ota_updates.update_id",
122122
}
123123

124-
// https://github.com/getsentry/sentry/blob/master/src/sentry/rules/match.py#L6-L22
124+
// https://github.com/getsentry/sentry/blob/master/src/sentry/rules/match.py
125125
var MatchTypes = []string{
126126
"CONTAINS",
127127
"ENDS_WITH",
@@ -141,7 +141,7 @@ var MatchTypes = []string{
141141
"STARTS_WITH",
142142
}
143143

144-
// https://github.com/getsentry/sentry/blob/master/src/sentry/rules/match.py#L6-L22
144+
// https://github.com/getsentry/sentry/blob/master/src/sentry/rules/match.py
145145
var MatchTypeNameToId = map[string]string{
146146
"CONTAINS": "co",
147147
"ENDS_WITH": "ew",
@@ -161,7 +161,7 @@ var MatchTypeNameToId = map[string]string{
161161
"STARTS_WITH": "sw",
162162
}
163163

164-
// https://github.com/getsentry/sentry/blob/master/src/sentry/rules/match.py#L6-L22
164+
// https://github.com/getsentry/sentry/blob/master/src/sentry/rules/match.py
165165
var MatchTypeIdToName = map[string]string{
166166
"co": "CONTAINS",
167167
"ew": "ENDS_WITH",
@@ -181,14 +181,14 @@ var MatchTypeIdToName = map[string]string{
181181
"sw": "STARTS_WITH",
182182
}
183183

184-
// https://github.com/getsentry/sentry/blob/master/src/sentry/rules/match.py#L25-L29
184+
// https://github.com/getsentry/sentry/blob/master/src/sentry/rules/match.py
185185
var LevelMatchTypes = []string{
186186
"EQUAL",
187187
"GREATER_OR_EQUAL",
188188
"LESS_OR_EQUAL",
189189
}
190190

191-
// https://github.com/getsentry/sentry/blob/master/src/sentry/models/dashboard_widget.py#L49-L83
191+
// https://github.com/getsentry/sentry/blob/master/src/sentry/models/dashboard_widget.py
192192
var DashboardWidgetTypes = []string{
193193
"discover",
194194
"issue",
@@ -199,7 +199,7 @@ var DashboardWidgetTypes = []string{
199199
"logs",
200200
}
201201

202-
// https://github.com/getsentry/sentry/blob/master/src/sentry/models/dashboard_widget.py#L133-L150
202+
// https://github.com/getsentry/sentry/blob/master/src/sentry/models/dashboard_widget.py
203203
var DashboardWidgetDisplayTypes = []string{
204204
"line",
205205
"area",
@@ -210,7 +210,7 @@ var DashboardWidgetDisplayTypes = []string{
210210
"top_n",
211211
}
212212

213-
// https://github.com/getsentry/sentry/blob/master/src/sentry/models/project.py#L61-L170
213+
// https://github.com/getsentry/sentry/blob/master/src/sentry/models/project.py
214214
var Platforms = []string{
215215
"other",
216216
"android",

0 commit comments

Comments
 (0)