mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-08-29 04:26:20 +00:00
44 lines
1.5 KiB
YAML
44 lines
1.5 KiB
YAML
name: Discussion Helper Bot
|
|
|
|
on:
|
|
discussion_comment:
|
|
types: [created]
|
|
|
|
jobs:
|
|
|
|
mark-answered:
|
|
name: Mark Discussions as Answered
|
|
runs-on: ubuntu-latest
|
|
if: |
|
|
github.event.action == 'created' &&
|
|
contains(github.event.comment.body, '/answered') &&
|
|
(github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'COLLABORATOR')
|
|
steps:
|
|
- name: Mark as answered
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const discussion = context.payload.discussion;
|
|
const commentId = context.payload.comment.id;
|
|
|
|
try {
|
|
// Mark the comment as the answer
|
|
await github.rest.discussions.markAnswerComment({
|
|
discussion_number: discussion.number,
|
|
comment_number: commentId,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo
|
|
});
|
|
|
|
// Mark the discussion as answered
|
|
await github.rest.discussions.markAsAnswer({
|
|
discussion_number: discussion.number,
|
|
comment_number: commentId,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo
|
|
});
|
|
} catch (error) {
|
|
console.log('Could not mark as answered (may require manual action):', error.message);
|
|
}
|
|
|