@@ -15,69 +15,141 @@ jobs:
1515 # 自动欢迎
1616 - name : Welcome Comment
1717 if : github.event_name == 'issues' && github.event.action == 'opened'
18- uses : actions-cool/issues-helper@v3
18+ uses : actions/github-script@v7
1919 with :
20- actions : " create-comment"
21- token : ${{ secrets.GITHUB_TOKEN }}
22- body : |
23- 👋 您好 @${{ github.event.issue.user.login }},感谢提交 Issue!
24- 🚀 我们已经收到您的反馈,会尽快确认你的问题
20+ script : |
21+ const login = context.payload.issue.user.login;
22+ await github.rest.issues.createComment({
23+ owner: context.repo.owner,
24+ repo: context.repo.repo,
25+ issue_number: context.issue.number,
26+ body: [
27+ `👋 您好 @${login},感谢提交 Issue!`,
28+ `🚀 我们已经收到您的反馈,会尽快确认你的问题`,
29+ ``,
30+ `在等待回复期间,您可以:`,
31+ ` - 📖 查看 [项目文档](https://github.com/SPlayer-Dev/SPlayer/blob/dev/README.md)`,
32+ ` - 🔍 搜索 [现有 Issues](https://github.com/SPlayer-Dev/SPlayer/issues) 查看是否有类似问题`,
33+ ].join('\n'),
34+ });
2535
26- 在等待回复期间,您可以:
27- - 📖 查看 [项目文档](https://github.com/imsyy/SPlayer/blob/dev/README.md)
28- - 🔍 搜索 [现有 Issues](https://github.com/imsyy/SPlayer/issues) 查看是否有类似问题
29- # 自动关闭
36+ # 自动关闭(不会修复 / 无效 / 重复)
3037 - name : Auto Close
3138 if : github.event.action == 'labeled' && contains(fromJSON('["不会修复", "无效", "重复"]'), github.event.label.name)
32- uses : actions-cool/issues-helper@v3
39+ uses : actions/github-script@v7
3340 with :
34- actions : " create-comment, close-issue"
35- token : ${{ secrets.GITHUB_TOKEN }}
36- body : |
37- 抱歉,由于被标记为 **${{ github.event.label.name }}**,该 Issue 将自动关闭
38- 如果您认为该 Issue 仍然有效,请创建新的 Issue,我们会尽快确认并修复
41+ script : |
42+ const labelName = context.payload.label.name;
43+ await github.rest.issues.createComment({
44+ owner: context.repo.owner,
45+ repo: context.repo.repo,
46+ issue_number: context.issue.number,
47+ body: [
48+ `抱歉,由于被标记为 **${labelName}**,该 Issue 将自动关闭`,
49+ `如果您认为该 Issue 仍然有效,请创建新的 Issue,我们会尽快确认并修复`,
50+ ].join('\n'),
51+ });
52+ await github.rest.issues.update({
53+ owner: context.repo.owner,
54+ repo: context.repo.repo,
55+ issue_number: context.issue.number,
56+ state: 'closed',
57+ state_reason: 'not_planned',
58+ });
59+
3960 # 有问题回复
4061 - name : Auto Reply
4162 if : github.event.action == 'labeled' && github.event.label.name == '有问题'
42- uses : actions-cool/issues-helper@v3
63+ uses : actions/github-script@v7
4364 with :
44- actions : " create-comment"
45- token : ${{ secrets.GITHUB_TOKEN }}
46- body : |
47- 🤝 您好 @${{ github.event.issue.user.login }},感谢您的反馈!
48- 由于缺少复现步骤,我们无法重现问题,因此无法修复
49- 请确保您已经详细描述了问题的复现步骤,维护团队会尽快查看
50- # 已确认 BUG
65+ script : |
66+ const login = context.payload.issue.user.login;
67+ await github.rest.issues.createComment({
68+ owner: context.repo.owner,
69+ repo: context.repo.repo,
70+ issue_number: context.issue.number,
71+ body: [
72+ `🤝 您好 @${login},感谢您的反馈!`,
73+ `由于缺少复现步骤,我们无法重现问题,因此无法修复`,
74+ `请确保您已经详细描述了问题的复现步骤,维护团队会尽快查看`,
75+ ].join('\n'),
76+ });
77+
78+ # 已确认 BUG(移除「有问题 / 过期」标签并回复)
5179 - name : Auto Confirm BUG
5280 if : github.event.action == 'labeled' && github.event.label.name == 'BUG'
53- uses : actions-cool/issues-helper@v3
81+ uses : actions/github-script@v7
5482 with :
55- actions : " remove-labels, create-comment"
56- token : ${{ secrets.GITHUB_TOKEN }}
57- labels : " 有问题, 过期"
58- body : |
59- 🤝 您好 @${{ github.event.issue.user.login }},感谢您的反馈!我们已经确认该问题,并将在下一个版本中修复
83+ script : |
84+ const login = context.payload.issue.user.login;
85+ for (const name of ['有问题', '过期']) {
86+ try {
87+ await github.rest.issues.removeLabel({
88+ owner: context.repo.owner,
89+ repo: context.repo.repo,
90+ issue_number: context.issue.number,
91+ name,
92+ });
93+ } catch (error) {
94+ if (error.status !== 404) throw error;
95+ }
96+ }
97+ await github.rest.issues.createComment({
98+ owner: context.repo.owner,
99+ repo: context.repo.repo,
100+ issue_number: context.issue.number,
101+ body: `🤝 您好 @${login},感谢您的反馈!我们已经确认该问题,并将在下一个版本中修复`,
102+ });
103+
60104 # 无法复现
61105 - name : Auto Unreproducible
62106 if : github.event.action == 'labeled' && github.event.label.name == '无法复现'
63- uses : actions-cool/issues-helper@v3
107+ uses : actions/github-script@v7
64108 with :
65- actions : " create-comment"
66- token : ${{ secrets.GITHUB_TOKEN }}
67- body : |
68- 🤝 您好 @${{ github.event.issue.user.login }},感谢您的反馈!
69- 由于无法复现问题,我们无法修复
70- 请确保您已经详细描述了问题的复现步骤,维护团队会尽快查看
71- # 已修复
109+ script : |
110+ const login = context.payload.issue.user.login;
111+ await github.rest.issues.createComment({
112+ owner: context.repo.owner,
113+ repo: context.repo.repo,
114+ issue_number: context.issue.number,
115+ body: [
116+ `🤝 您好 @${login},感谢您的反馈!`,
117+ `由于无法复现问题,我们无法修复`,
118+ `请确保您已经详细描述了问题的复现步骤,维护团队会尽快查看`,
119+ ].join('\n'),
120+ });
121+
122+ # 已修复(移除「BUG」标签、回复并关闭)
72123 - name : Auto Fixed
73124 if : github.event.action == 'labeled' && github.event.label.name == '已修复'
74- uses : actions-cool/issues-helper@v3
125+ uses : actions/github-script@v7
75126 with :
76- actions : " create-comment, remove-labels, close-issue"
77- token : ${{ secrets.GITHUB_TOKEN }}
78- labels : " BUG"
79- close-reason : " completed"
80- body : |
81- 🎉 您好 @${{ github.event.issue.user.login }},感谢您的反馈!
82- 该问题已在当前开发版或下一个正式版中修复完成。
83- 若您觉得仍存在问题,请创建新的 Issue,我们会尽快确认并修复
127+ script : |
128+ const login = context.payload.issue.user.login;
129+ await github.rest.issues.createComment({
130+ owner: context.repo.owner,
131+ repo: context.repo.repo,
132+ issue_number: context.issue.number,
133+ body: [
134+ `🎉 您好 @${login},感谢您的反馈!`,
135+ `该问题已在当前开发版或下一个正式版中修复完成。`,
136+ `若您觉得仍存在问题,请创建新的 Issue,我们会尽快确认并修复`,
137+ ].join('\n'),
138+ });
139+ try {
140+ await github.rest.issues.removeLabel({
141+ owner: context.repo.owner,
142+ repo: context.repo.repo,
143+ issue_number: context.issue.number,
144+ name: 'BUG',
145+ });
146+ } catch (error) {
147+ if (error.status !== 404) throw error;
148+ }
149+ await github.rest.issues.update({
150+ owner: context.repo.owner,
151+ repo: context.repo.repo,
152+ issue_number: context.issue.number,
153+ state: 'closed',
154+ state_reason: 'completed',
155+ });
0 commit comments