-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (32 loc) · 1.22 KB
/
main.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: Pull Request Review Labeler
on:
pull_request:
types: [opened]
jobs:
check_author_team_membership:
runs-on: ubuntu-latest
steps:
- name: Check if author is opsTrack member
id: check_author
run: |
response=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/orgs/${{ github.event.organization.login }}/teams/opsTrack/members")
if echo "$response" | grep -q "\"login\": \"${{ github.event.pull_request.user.login }}\""; then
echo "::set-output name=isMember::true"
else
echo "::set-output name=isMember::false"
fi
label_pr_needing_reviews:
needs: check_author_team_membership
runs-on: ubuntu-latest
steps:
- name: Check if opsTrack member
id: opsTrack_member_check
run: echo "Author is opsTrack member:${{ needs.check_author_team_membership.outputs.isMember }}"
- name: Add label if opsTrack member
if: steps.check_author_team_membership.outputs.isMember == 'true'
uses: dessant/label-actions@v4
with:
action: add
labels: codeowner reviews required
repo-token: ${{ secrets.GITHUB_TOKEN }}