mirror of
https://github.com/safishamsi/graphify.git
synced 2026-10-13 07:29:33 +00:00
ci: welcome new issues/PRs and invite them to Discord
Auto-comment on every opened issue and pull request (skipping bots) pointing contributors to the Discord server for real-time discussion and to GitHub Discussions for longer-form threads. Uses actions/github-script; pull_request_target is used so fork PRs can be commented on, and the job only posts a comment (no checkout/run of PR code), so it is safe. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
4139885a12
commit
ac48534d5a
1 file changed
+56
@@ -0,0 +1,56 @@
|
||||
name: Welcome and invite to Discord
|
||||
|
||||
# Posts a friendly comment when someone opens an issue or a pull request,
|
||||
# pointing them to Discord (real-time) and GitHub Discussions (longer-form).
|
||||
# pull_request_target is used so the token can comment on PRs from forks;
|
||||
# the job only posts a comment and never checks out or runs PR code, so this
|
||||
# is safe.
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
welcome:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const isPR = context.eventName === 'pull_request_target';
|
||||
const payload = isPR ? context.payload.pull_request : context.payload.issue;
|
||||
const author = payload.user.login;
|
||||
const number = payload.number;
|
||||
|
||||
// Don't comment on bot-opened issues/PRs (dependabot, etc.).
|
||||
if (author.endsWith('[bot]')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const discord = 'https://discord.gg/XDnKVpzdXB';
|
||||
const discussions = 'https://github.com/Graphify-Labs/graphify/discussions';
|
||||
|
||||
const body = isPR
|
||||
? `Thanks for the pull request, @${author}. A maintainer will review it soon.\n\n`
|
||||
+ `Want to talk it through while it is in review? Come join us on Discord: ${discord}. `
|
||||
+ `For longer-form discussion there is also [GitHub Discussions](${discussions}).\n\n`
|
||||
+ `A couple of things that speed up review: make sure the test suite passes on Python 3.10 and 3.13, `
|
||||
+ `and that the change keeps extraction deterministic.`
|
||||
: `Thanks for opening this issue, @${author}. A maintainer will take a look soon.\n\n`
|
||||
+ `If you would like to discuss it in real time, come say hi on our Discord: ${discord}. `
|
||||
+ `For longer-form questions and ideas there is also [GitHub Discussions](${discussions}).\n\n`
|
||||
+ `To help us triage, please make sure the report includes what you expected, what actually happened, `
|
||||
+ `and the steps (and a small sample) to reproduce it.`;
|
||||
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: number,
|
||||
body,
|
||||
});
|
||||
Reference in new issue
Block a user