-
-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (37 loc) · 1.57 KB
/
Copy pathwelcome.yml
File metadata and controls
42 lines (37 loc) · 1.57 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
name: Welcome New Contributor
on:
pull_request_target:
types: [opened]
jobs:
welcome:
runs-on: ubuntu-latest
if: github.event.pull_request.user.type != 'Bot'
permissions:
pull-requests: write
steps:
- name: Welcome First-Time Contributor
uses: actions/github-script@v7
with:
script: |
const creator = context.payload.pull_request.user.login;
const owner = context.repo.owner;
const repo = context.repo.repo;
const prNumber = context.payload.pull_request.number;
const { data: searchResult } = await github.rest.search.issuesAndPullRequests({
q: `is:pr author:${creator} repo:${owner}/${repo}`
});
if (searchResult.total_count === 1) {
const welcomeMessage = `Welcome to **Graphical Playground (${repo})**, @${creator}! 🎉\n\n` +
`We are thrilled to have you here and appreciate you opening your first Pull Request! \n\n` +
`### What's next?\n` +
`- Please ensure your code follows our formatting guidelines.\n` +
`- If you haven't already, take a quick look at our [Contributing Guidelines](CONTRIBUTING.md).\n` +
`- A maintainer will review your code shortly.\n\n` +
`Thanks again for your contribution!`;
await github.rest.issues.createComment({
owner: owner,
repo: repo,
issue_number: prNumber,
body: welcomeMessage
});
}