Skip to content

Commit

Permalink
Add external PR labeler action
Browse files Browse the repository at this point in the history
  • Loading branch information
cbbayburt committed Aug 11, 2023
1 parent dbabcf3 commit 0e56c35
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/external_pr_labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: External PR labeler

on:
pull_request_target:
# types:
# - opened

jobs:
label_prs:
name: Label external PRs
runs-on: ubuntu-latest
permissions: read-all
steps:
# - id: is_member
# name: Check if author is an org member
# run: |
# curl -L \
# -H "Accept: application/vnd.github+json" \
# -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
# -H "X-GitHub-Api-Version: 2022-11-28" \
# https://api.github.com/orgs/uyuni-project/members/${{ github.actor }}

- id: is_member
name: Check if author is an org member
env:
GH_TOKEN: ${{ secrets.ORG_READ_TOKEN }}
run: |
gh api orgs/uyuni-project/members/does_not_exist
RESULT=$?
echo "result=$RESULT" >> "$GITHUB_OUTPUT"
exit $RESULT
- name: Label the PR
if: ${{ failure() }}
run: |
echo "Actor: ${{ github.actor }}"
echo "Is a member? ${{ steps.is_member.outputs.result }}"
# - uses: tspascoal/get-user-teams-membership@v2
# with:
# username: ${{ github.actor }}
# team: 'uyuni-project'
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 0e56c35

Please sign in to comment.