-
Notifications
You must be signed in to change notification settings - Fork 11
36 lines (31 loc) · 1004 Bytes
/
first-pr-labeler.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
name: First PR Labeler
on:
pull_request:
types: [opened]
jobs:
first-pr:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Check if first contribution
id: check
uses: actions/github-script@v7
with:
script: |
const creator = context.payload.pull_request.user.login;
const pullRequests = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'all',
per_page: 100
});
const creatorPRs = pullRequests.data.filter(pr => pr.user.login === creator);
if (creatorPRs.length === 1) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['good first PR']
});
}