Skip to content

Commit e909e9f

Browse files
brunoborgesCopilot
andcommitted
Add code issue template and link Contribute button to it
- Create .github/ISSUE_TEMPLATE/code-issue.yml for reporting code bugs in patterns - Update generate.java to use the new template with pre-filled category and slug Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d57685c commit e909e9f

File tree

2 files changed

+93
-7
lines changed

2 files changed

+93
-7
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
name: Code Issue in Pattern
3+
description: Report incorrect, outdated, or broken code in an existing pattern
4+
title: "[Code Issue] "
5+
labels: ["bug", "slug"]
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: |
10+
## Report a code issue
11+
12+
Found a bug, compilation error, or inaccuracy in the code examples
13+
of an existing pattern? Let us know so we can fix it.
14+
15+
- type: dropdown
16+
id: category
17+
attributes:
18+
label: Category
19+
options:
20+
- language
21+
- collections
22+
- strings
23+
- streams
24+
- concurrency
25+
- io
26+
- errors
27+
- datetime
28+
- security
29+
- tooling
30+
- enterprise
31+
validations:
32+
required: true
33+
34+
- type: input
35+
id: slug
36+
attributes:
37+
label: Pattern slug
38+
description: "The slug of the affected pattern (e.g., `type-inference-with-var`)"
39+
placeholder: "type-inference-with-var"
40+
validations:
41+
required: true
42+
43+
- type: dropdown
44+
id: affected-code
45+
attributes:
46+
label: Which code is affected?
47+
options:
48+
- Old code example
49+
- Modern code example
50+
- Both
51+
validations:
52+
required: true
53+
54+
- type: dropdown
55+
id: issue-type
56+
attributes:
57+
label: Type of issue
58+
options:
59+
- Code doesn't compile
60+
- Incorrect or misleading output
61+
- Outdated API usage
62+
- Missing imports or context
63+
- Better modern alternative exists
64+
- Other
65+
validations:
66+
required: true
67+
68+
- type: textarea
69+
id: description
70+
attributes:
71+
label: Describe the issue
72+
description: "Explain what's wrong with the current code"
73+
validations:
74+
required: true
75+
76+
- type: textarea
77+
id: suggested-fix
78+
attributes:
79+
label: Suggested fix
80+
description: "If you have a fix, paste the corrected code here"
81+
render: java
82+
83+
- type: input
84+
id: jdk-version
85+
attributes:
86+
label: JDK version tested
87+
description: "Which JDK version did you use to identify this issue?"
88+
placeholder: "21"

html-generators/generate.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -419,13 +419,11 @@ String renderSocialShare(String tpl, String slug, String title, Map<String, Stri
419419
static final String GITHUB_ISSUES_URL = "https://github.com/javaevolved/javaevolved.github.io/issues/new";
420420

421421
Map<String, String> buildContributeUrls(Snippet s, String locale, String localeName) {
422-
var pageUrl = locale.equals("en")
423-
? "%s/%s/%s.html".formatted(BASE_URL, s.category(), s.slug())
424-
: "%s/%s/%s/%s.html".formatted(BASE_URL, locale, s.category(), s.slug());
425-
426-
var codeTitle = urlEncode("[Code Issue] %s".formatted(s.title()));
427-
var codeBody = urlEncode("**Pattern:** %s\n**URL:** %s\n\nDescribe the issue:\n".formatted(s.slug(), pageUrl));
428-
var codeUrl = "%s?title=%s&labels=%s&body=%s".formatted(GITHUB_ISSUES_URL, codeTitle, "bug", codeBody);
422+
var codeUrl = "%s?template=code-issue.yml&title=%s&category=%s&slug=%s".formatted(
423+
GITHUB_ISSUES_URL,
424+
urlEncode("[Code Issue] %s".formatted(s.title())),
425+
urlEncode(s.category()),
426+
urlEncode(s.slug()));
429427

430428
var cleanLocaleName = localeName.replaceFirst("^[^\\p{L}]+", "");
431429
var transUrl = "%s?template=translation-issue.yml&title=%s&locale=%s&pattern=%s&area=%s".formatted(

0 commit comments

Comments
 (0)