Skip to content

Commit 301b08d

Browse files
authored
Update version-check.yml
1 parent 72a7693 commit 301b08d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/version-check.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,21 @@ jobs:
113113
const formattedAllowedVersions = allowedVersions.map(v => `\`${v}\``).join(', ');
114114
console.log(`Allowed versions: ${JSON.stringify(allowedVersions)}`);
115115
116+
// 获取所有 bot 之前的评论
117+
const comments = await github.rest.issues.listComments({
118+
owner: context.repo.owner,
119+
repo: context.repo.repo,
120+
issue_number: issue.number,
121+
});
122+
123+
// 查找本机器人之前的警告信息评论
124+
const botComments = comments.data.filter(comment => {
125+
return comment.user.type === 'Bot' &&
126+
(comment.body.includes('温馨提示:版本信息格式问题') ||
127+
comment.body.includes('温馨提示:缺少版本信息') ||
128+
comment.body.includes('温馨提示:版本需要更新'));
129+
});
130+
116131
const issueBody = issue.body;
117132
if (!issueBody) {
118133
console.log('Issue body is empty. Closing issue due to invalid format.');
@@ -216,6 +231,20 @@ jobs:
216231
});
217232
}
218233
234+
// 隐藏之前的机器人警告信息
235+
if (botComments.length > 0) {
236+
for (const comment of botComments) {
237+
// 更新评论,在前面添加 Resolved 标记
238+
const updatedBody = `~~${comment.body}~~\n\n**Resolved: 此问题已解决,用户现在使用了支持的版本** / **This issue has been resolved, the user is now using a supported version**`;
239+
await github.rest.issues.updateComment({
240+
owner: context.repo.owner,
241+
repo: context.repo.repo,
242+
comment_id: comment.id,
243+
body: updatedBody
244+
});
245+
}
246+
}
247+
219248
return;
220249
} else {
221250
console.log('Version is outside allowed range. Closing issue.');

0 commit comments

Comments
 (0)