8000 Add discussion comment workflow by roomrys · Pull Request #1945 · talmolab/sleap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add discussion comment workflow #1945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Sep 6, 2024
Merged
50 changes: 50 additions & 0 deletions .github/workflows/comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Comment on New Discussions

on:
discussion:
types: [created]

jobs:
comment:
runs-on: ubuntu-latest

steps:
- name: Post a multi-line comment on a new discussion
uses: actions/github-script@v6
with:
script: |
const { owner, repo } = context.repo;
const discussion_id = context.payload.discussion.node_id;

const mutation = `
mutation($discussionId: ID!, $body: String!) {
addDiscussionComment(input: {discussionId: $discussionId, body: $body}) {
comment {
id
}
}
}
`;

const body = `
Thank you for starting a new discussion!

We appreciate your input and will review it soon.

> [!WARNING]
> A friendly reminder that this is a public forum. Please be cautious when clicking links, downloading files, or running scripts posted by others.
>
> - Always verify the credibility of links and code.
> - Avoid running scripts or installing files from untrusted sources.
> - If you're unsure, ask for clarification before proceeding.

Stay safe and happy SLEAPing!

Best regards,
The Team
`;

await github.graphql(mutation, {
discussionId: discussion_id,
body: body.trim() // Removes trailing/leading whitespace
});
0