-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (55 loc) · 2.4 KB
/
welcome.yml
File metadata and controls
59 lines (55 loc) · 2.4 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
name: Welcome first-time contributors
on:
pull_request_target:
types: [opened]
issues:
types: [opened]
jobs:
welcome:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Welcome first-time PR contributor
if: github.event_name == 'pull_request_target'
uses: actions/github-script@v7
with:
script: |
const { data: prs } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'all',
per_page: 100,
});
const authorPRs = prs.filter(
pr => pr.user.login === context.payload.pull_request.user.login
);
if (authorPRs.length === 1) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `👋 Thanks for your first contribution to **Awesome API Wrappers**, @${context.payload.pull_request.user.login}!\n\nA maintainer will review your submission shortly. In the meantime, double-check that your entry:\n- Follows the [entry format](https://github.com/Api-Wrappers/awesome-api-wrappers/blob/main/CONTRIBUTING.md#entry-format)\n- Is placed alphabetically within the correct section\n- Has a description that ends with a period and contains no marketing language\n\nWe appreciate you helping make this list better! 🙌`,
});
}
- name: Welcome first-time issue author
if: github.event_name == 'issues'
uses: actions/github-script@v7
with:
script: |
const { data: issues } = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'all',
creator: context.payload.issue.user.login,
per_page: 100,
});
if (issues.length === 1) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
body: `👋 Thanks for opening your first issue, @${context.payload.issue.user.login}! A maintainer will take a look soon.`,
});
}