Skip to content

Update main.yml

Update main.yml #20

Workflow file for this run

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 }}