Skip to content

Commit 8e04f78

Browse files
gonizrekram1-node
authored andcommitted
ci: added gh workflow that adds 'contributor' label to PRs/Issues (anomalyco#11118)
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
1 parent e0eb99c commit 8e04f78

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Add Contributors Label
2+
3+
on:
4+
# issues:
5+
# types: [opened]
6+
7+
pull_request_target:
8+
types: [opened]
9+
10+
jobs:
11+
add-contributor-label:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
pull-requests: write
15+
issues: write
16+
17+
steps:
18+
- name: Add Contributor Label
19+
uses: actions/github-script@v8
20+
with:
21+
script: |
22+
const isPR = !!context.payload.pull_request;
23+
const issueNumber = isPR ? context.payload.pull_request.number : context.payload.issue.number;
24+
const authorAssociation = isPR ? context.payload.pull_request.author_association : context.payload.issue.author_association;
25+
26+
if (authorAssociation === 'CONTRIBUTOR') {
27+
await github.rest.issues.addLabels({
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
issue_number: issueNumber,
31+
labels: ['contributor']
32+
});
33+
}

0 commit comments

Comments
 (0)