-
Notifications
You must be signed in to change notification settings - Fork 38
40 lines (37 loc) · 1.27 KB
/
first-pr.yml
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
name: First PR
on:
pull_request:
types:
- opened
permissions:
contents: read
issues: read
pull-requests: write
jobs:
first-pr:
runs-on: ubuntu-latest
env:
IMAGE_URL: https://raw.githubusercontent.com/AmadeusITGroup/otter/main/assets/logo/flavors/fireworks.png
steps:
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const [owner, repo] = '${{ github.repository }}'.split('/');
github.rest.issues.listForRepo({
state: 'all',
repo: repo,
owner: owner,
creator: '${{ github.actor }}'
}).then((reply) => {
const countPR = reply.data.filter((data) => data.pull_request).length;
if (countPR === 1) {
github.rest.issues.createComment({
issue_number: context.issue.number,
repo: repo,
owner: owner,
body: '![](${{ env.IMAGE_URL }})\nThank you so much @${{ github.actor }} for opening your first PR here!'
});
} else {
console.log(`${{ github.actor }} has already opened ${countPR - 1} PRs before this one.`);
}
});