File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,44 @@ permissions:
2323concurrency : pr-${{ github.ref }}
2424
2525jobs :
26+ community-label :
27+ runs-on : ubuntu-latest
28+ permissions :
29+ pull-requests : write
30+ if : >-
31+ ${{
32+ github.event_name == 'pull_request_target' &&
33+ github.event.action == 'opened' &&
34+ github.event.pull_request.author_association != 'MEMBER' &&
35+ github.event.pull_request.author_association != 'COLLABORATOR' &&
36+ github.event.pull_request.author_association != 'OWNER'
37+ }}
38+ steps :
39+ - name : Add community label
40+ uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
41+ with :
42+ script : |
43+ const params = {
44+ issue_number: context.issue.number,
45+ owner: context.repo.owner,
46+ repo: context.repo.repo,
47+ }
48+
49+ const labels = context.payload.pull_request.labels.map((label) => label.name)
50+ if (labels.includes("community")) {
51+ console.log('PR already has "community" label.')
52+ return
53+ }
54+
55+ console.log(
56+ 'Adding "community" label for author association "%s".',
57+ context.payload.pull_request.author_association,
58+ )
59+ await github.rest.issues.addLabels({
60+ ...params,
61+ labels: ["community"],
62+ })
63+
2664 cla :
2765 runs-on : ubuntu-latest
2866 permissions :
You can’t perform that action at this time.
0 commit comments