Skip to content

Update main.yml

Update main.yml #6

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: |
team_members=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/orgs/${{ github.event.organization.login }}/teams/opsTrack/members" | \
jq -r '.[].login')
author_login=$(jq -r '.sender.login' $GITHUB_EVENT_PATH)
is_member=$(echo "$team_members" | grep -c "$author_login")
echo "::set-output name=isMember::$is_member"
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 }}"

Check failure on line 27 in .github/workflows/main.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/main.yml

Invalid workflow file

You have an error in your yaml syntax on line 27
- name: Add label if opsTrack member
if: steps.opsTrack_member_check.outputs.isMember == '1'
run: |
echo "Author is a member of opsTrack team, adding label..."
curl -X POST \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/labels" \
-d '{"labels":["codeowner reviews required"]}'