MCPcopy
hub / github.com/webfansplz/vuejs-challenges / updateComment

Function updateComment

scripts/actions/issue-pr.ts:220–248  ·  view source on GitHub ↗
(github: Github, context: Context, body: string)

Source from the content-addressed store, hash-verified

218}
219
220async function updateComment(github: Github, context: Context, body: string) {
221 const { data: comments } = await github.issues.listComments({
222 issue_number: context.issue.number,
223 owner: context.repo.owner,
224 repo: context.repo.repo,
225 })
226
227 const existing_comment = comments.find(
228 item => item.user!.login === "github-actions[bot]",
229 )
230
231 if (existing_comment) {
232 return await github.issues.updateComment({
233 comment_id: existing_comment.id,
234 issue_number: context.issue.number,
235 owner: context.repo.owner,
236 repo: context.repo.repo,
237 body,
238 })
239 }
240 else {
241 return await github.issues.createComment({
242 issue_number: context.issue.number,
243 owner: context.repo.owner,
244 repo: context.repo.repo,
245 body,
246 })
247 }
248}
249
250function getFileName(text: string) {
251 /* eslint-disable prefer-regex-literals */

Callers 1

actionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected