forked from Ikalus1988/MisakaNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlesson-issue-comment-newbie-welcome.json
More file actions
16 lines (16 loc) · 1.97 KB
/
Copy pathlesson-issue-comment-newbie-welcome.json
File metadata and controls
16 lines (16 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"task_id": "lesson-issue-comment-newbie-welcome",
"title": "利用 issue_comment 事件实现新手自动欢迎",
"domain": "devops",
"tags": [
"github-actions",
"ci",
"community",
"newbie",
"good-first-issue"
],
"problem": "开源项目设置 Good First Issues 后,新手贡献者往往不知道如何开始。需要一种自动化的方式在贡献者评论 Issue 时立即给予引导。",
"solution": "利用 `issue_comment` 事件 + `github-actions[bot]` 自动回复。\n\n### 工作流\n\n```yaml\n# .github/workflows/newbie-welcome.yml\nname: Newbie Welcome\non:\n issue_comment:\n types: [created]\n\npermissions:\n issues: write\n pull-requests: read\n\njobs:\n welcome:\n if: |\n !github.event.issue.pull_request &&\n contains(github.event.issue.labels.*.name, 'good first issue') &&\n !contains(fromJSON('[\"MEMBER\", \"OWNER\", \"COLLABORATOR\"]'), github.event.comment.author_association)\n runs-on: ubuntu-latest\n steps:\n - uses: actions/github-script@v7\n with:\n script: |\n const body = `## 👋 Welcome to MisakaNet!\n\n You're commenting on a **Good First Issue**.\n\n 1. Read the CONTRIBUTING.md guide\n 2. Claim by commenting \\`/claim\\` — 8h exclusive window\n 3. Implement with \\`git commit -s\\`\n 4. Submit a PR — CI audits automatically`;\n await github.rest.issues.createComment({ ... });\n```\n\n### 关键点\n\n1. **触发条件过滤** — 仅对非 PR 的 Issue 评论、且带 `good first issue` 标签、且非项目成员(MEMBER/OWNER/COLLABORATOR)触发。避免骚扰维护者自己的对话。\n2. **无需注册 Bot** — 使用 `github-actions[bot]` 内置身份即可,不需要单独创建 GitHub App。\n3. **权限最小化** — `issues: write`(写评论)+ `pull-requests: read`(判断是否为 PR)。",
"source": "lessons/contrib/issue-comment-newbie-welcome.md",
"test_cmd": ""
}