Handle the different output depending the API protocol for event_details #1605
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: External PR labeler | |
on: | |
pull_request_target: | |
types: | |
- opened | |
jobs: | |
label_prs: | |
name: Label external PRs | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- id: is_member | |
name: Check if author is an org member | |
env: | |
GH_TOKEN: ${{ secrets.ORG_READ_TOKEN }} | |
run: | | |
# The following API call returns 404 if user is not a member of the uyuni-project org | |
# See: https://docs.github.com/rest/orgs/members#check-organization-membership-for-a-user--status-codes | |
RESULT=`gh api orgs/uyuni-project/members/${{ github.actor }} -i | head -1 | awk '{ print $2 }'` | |
echo "result=$RESULT" >> "$GITHUB_OUTPUT" | |
- name: Label the PR | |
# If not a member of org | |
if: ${{ steps.is_member.outputs.result == 404 }} | |
uses: christianvuerings/add-labels@v1 | |
with: | |
labels: "community" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |