Skip to content

Commit 2293d87

Browse files
maryam-saeidiqn895
authored andcommitted
Automate labeling PRs with obs-ux-management team via GitHub Actions (elastic#220533)
## Summary We would like to add the `author:obs-ux-management` label to the PRs if the author of a PR is one of our team members. I tested this logic in another [repo](maryam-saeidi/testing#3).
1 parent 8a21fb2 commit 2293d87

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Add author:obs-ux-management label to PRs
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
7+
jobs:
8+
label-obs-ux-management-team:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
pull-requests: write
12+
contents: read
13+
14+
steps:
15+
- name: Label if author is in the obs-ux-management team
16+
uses: actions/github-script@v7
17+
with:
18+
script: |
19+
const obsUxManagementTeam = [
20+
"maryam-saeidi",
21+
"jasonrhodes",
22+
"kdelemme",
23+
"mgiota",
24+
"shahzad31",
25+
"fkanout",
26+
"dominiqueclarke",
27+
"justinkambic",
28+
"cesco-f",
29+
"benakansara",
30+
"baileycash-elastic"
31+
]; // GitHub usernames
32+
const label = "author:obs-ux-management";
33+
34+
const author = context.payload.pull_request.user.login;
35+
36+
if (obsUxManagementTeam.includes(author)) {
37+
await github.rest.issues.addLabels({
38+
owner: context.repo.owner,
39+
repo: context.repo.repo,
40+
issue_number: context.payload.pull_request.number,
41+
labels: [label],
42+
});
43+
}

0 commit comments

Comments
 (0)