Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 0 additions & 65 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

117 changes: 117 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Bug 报告 / Bug Report

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add the required changelog entry

This changes the contributor-facing issue filing flow by replacing the Markdown bug template with a required issue form and disabling blank issues, but the diff does not update docs/CHANGELOG.md. The repository rule in AGENTS.md says user-visible capability or workflow changes must be recorded in docs/CHANGELOG.md, so this PR should add an [Unreleased] entry to keep release notes and contributor workflow history in sync.

Useful? React with 👍 / 👎.

description: 报告一个可复现的问题 / Report a reproducible problem
title: "[Bug] "
labels:
- bug
body:
- type: markdown
attributes:
value: |
请先同步到最新代码再提交,避免重复报告已修复的问题。
Please sync to the latest version before filing, to avoid duplicate reports of already-fixed issues.
- type: checkboxes
id: latest_code
attributes:
label: 版本确认 / Version Check
description: Fork 用户请先同步 fork,再重新运行 Actions。 / Fork users should sync their fork before rerunning Actions.
options:
- label: 我已同步最新代码 / I am on the latest commit
required: true
- type: input
id: local_commit
attributes:
label: 本地代码版本 / Local commit hash
description: 运行 `git rev-parse --short HEAD` 后填写结果。 / Run `git rev-parse --short HEAD` and paste the result.
placeholder: e.g. a1b2c3d
validations:
required: true
Comment on lines +26 to +27

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Disable blank issues to require bug details

These required validations only run when the reporter chooses this new Bug Report form; I checked .github/ISSUE_TEMPLATE/config.yml, and blank_issues_enabled: true still leaves GitHub's “Open a blank issue” path available, so external users can bypass every required commit/log/reproduction field that this change is meant to collect. If the goal is to make reproducible bug context mandatory before triage, update the template chooser config (and cover it in this test) so blank issues are not offered to contributors.

Useful? React with 👍 / 👎.

- type: input
id: actions_commit
attributes:
label: GitHub Actions 代码版本 / GitHub Actions commit hash
description: 填写工作流日志顶部显示的 commit hash;如未使用 Actions,请填写 N/A。 / Use the commit hash shown at the top of the workflow log, or N/A if Actions was not used.
placeholder: e.g. a1b2c3d or N/A
validations:
required: true
- type: textarea
id: problem
attributes:
label: 问题描述 / Problem Description
description: 简明扼要地描述遇到的问题。 / Briefly describe the problem.
placeholder: 发生了什么问题? / What went wrong?
validations:
required: true
- type: textarea
id: steps
attributes:
label: 复现步骤 / Reproduction Steps
description: 请写出可复现的命令、配置和操作步骤。 / Include the command, config, and actions needed to reproduce.
placeholder: |
1. 执行命令 / Run command: ...
2. 配置 / Config: ...
3. 查看 / View: ...
4. 出现错误 / Error occurs: ...
validations:
required: true
- type: textarea
id: expected
attributes:
label: 期望行为 / Expected Behavior
description: 描述你期望发生的情况。 / Describe what you expected to happen.
validations:
required: true
- type: textarea
id: actual
attributes:
label: 实际行为 / Actual Behavior
description: 描述实际发生的情况。 / Describe what actually happened.
validations:
required: true
- type: textarea
id: logs
attributes:
label: 错误日志 / Error Logs
description: 粘贴完整相关日志;如没有日志,请填写 N/A。 / Paste complete relevant logs, or N/A if none are available.
render: shell
validations:
required: true
- type: input
id: os
attributes:
label: 操作系统 / OS
placeholder: e.g. Ubuntu 22.04 / Windows 11 / macOS 14
validations:
required: true
- type: input
id: python_version
attributes:
label: Python 版本 / Python version
placeholder: e.g. 3.11.8
validations:
required: true
- type: dropdown
id: run_mode
attributes:
label: 运行方式 / Run mode
options:
- Local
- Docker
- GitHub Actions
- Other
validations:
required: true
- type: textarea
id: config
attributes:
label: 相关配置 / Relevant config
description: 请至少说明 GEMINI_MODEL/AI model 和数据源;如不适用,请填写 N/A。 / Include at least GEMINI_MODEL/AI model and data source, or N/A if not applicable.
placeholder: |
GEMINI_MODEL / AI model:
数据源 / Data source:
validations:
required: true
- type: textarea
id: additional_context
attributes:
label: 其他信息 / Additional Context
description: 添加任何其他有关问题的信息或截图。 / Add any other context or screenshots about the problem.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
blank_issues_enabled: true
blank_issues_enabled: false
contact_links:
- name: 💬 讨论区 / Discussions
url: https://github.com/ZhuLinsen/daily_stock_analysis/discussions
Expand Down
57 changes: 57 additions & 0 deletions tests/test_issue_templates.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
from pathlib import Path

import yaml


ROOT = Path(__file__).resolve().parents[1]
ISSUE_TEMPLATE_DIR = ROOT / ".github" / "ISSUE_TEMPLATE"
BUG_REPORT_FORM = ISSUE_TEMPLATE_DIR / "bug_report.yml"
BUG_REPORT_MARKDOWN = ISSUE_TEMPLATE_DIR / "bug_report.md"
ISSUE_TEMPLATE_CONFIG = ISSUE_TEMPLATE_DIR / "config.yml"


def _body_item(form, item_id):
for item in form["body"]:
if item.get("id") == item_id:
return item
raise AssertionError(f"Missing issue form item: {item_id}")


def test_bug_report_uses_single_required_issue_form():
assert BUG_REPORT_FORM.exists()
assert not BUG_REPORT_MARKDOWN.exists()
assert ISSUE_TEMPLATE_CONFIG.exists()

form = yaml.safe_load(BUG_REPORT_FORM.read_text(encoding="utf-8"))
config = yaml.safe_load(ISSUE_TEMPLATE_CONFIG.read_text(encoding="utf-8"))

assert config["blank_issues_enabled"] is False
assert form["title"] == "[Bug] "
assert "bug" in form["labels"]
assert isinstance(form["body"], list)


def test_bug_report_requires_reproducible_bug_context():
form = yaml.safe_load(BUG_REPORT_FORM.read_text(encoding="utf-8"))

required_text_fields = {
"local_commit",
"actions_commit",
"problem",
"steps",
"expected",
"actual",
"logs",
"os",
"python_version",
"run_mode",
"config",
}

for item_id in required_text_fields:
item = _body_item(form, item_id)
assert item.get("validations", {}).get("required") is True

latest_code = _body_item(form, "latest_code")
assert latest_code["type"] == "checkboxes"
assert latest_code["attributes"]["options"][0]["required"] is True
Loading