-
Notifications
You must be signed in to change notification settings - Fork 2.8k
88 lines (79 loc) · 3.29 KB
/
component-pr-welcome.yml
File metadata and controls
88 lines (79 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Component PR Welcome
on:
pull_request_target:
types: [opened, reopened, synchronize]
paths:
- 'cli-tool/components/**'
permissions:
pull-requests: write
issues: write
jobs:
welcome:
name: Welcome & Label
runs-on: ubuntu-latest
steps:
- name: Add review-pending label and welcome comment
uses: actions/github-script@v8
with:
script: |
const { owner, repo } = context.repo;
const prNumber = context.issue.number;
const author = context.payload.pull_request.user.login;
const labelName = 'review-pending';
const labelColor = 'fbca04';
const labelDescription = 'Component PR awaiting maintainer review';
const marker = '<!-- component-pr-welcome:v1 -->';
try {
await github.rest.issues.getLabel({ owner, repo, name: labelName });
} catch (err) {
if (err.status === 404) {
await github.rest.issues.createLabel({
owner,
repo,
name: labelName,
color: labelColor,
description: labelDescription,
});
} else {
throw err;
}
}
await github.rest.issues.addLabels({
owner,
repo,
issue_number: prNumber,
labels: [labelName],
});
const existing = await github.paginate(
github.rest.issues.listComments,
{ owner, repo, issue_number: prNumber, per_page: 100 }
);
if (existing.some(c => c.body && c.body.includes(marker))) {
core.info('Welcome comment already posted — skipping comment, label ensured.');
return;
}
const body = [
marker,
`## 👋 Thanks for contributing, @${author}!`,
``,
`This PR touches \`cli-tool/components/**\` and has been marked **\`review-pending\`**.`,
``,
`### What happens next`,
`1. 🤖 **Automated security audit** runs and posts results on this PR.`,
`2. 👀 **Maintainer review** — a human reviewer validates the component with the \`component-reviewer\` agent (format, naming, security, clarity).`,
`3. ✅ **Merge** — once approved, your PR is merged to \`main\`.`,
`4. 📦 **Catalog regeneration** — the component catalog is rebuilt automatically.`,
`5. 🚀 **Live on [aitmpl.com](https://www.aitmpl.com)** — your component appears on the website after deploy.`,
``,
`### While you wait`,
`- Check the **Security Audit** comment below for any issues to fix.`,
`- Make sure your component follows the [contribution guide](https://github.com/${owner}/${repo}/blob/main/CLAUDE.md#component-system).`,
``,
`_This is an automated message. No action is required from you right now — a maintainer will review soon._`,
].join('\n');
await github.rest.issues.createComment({
owner,
repo,
issue_number: prNumber,
body,
});