forked from SAP/ai-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
26 lines (23 loc) · 795 Bytes
/
auth.yaml
File metadata and controls
26 lines (23 loc) · 795 Bytes
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
name: Check Actor Permission
on:
workflow_dispatch:
workflow_call:
jobs:
check-permission:
name: 'Check if actor has maintain role'
runs-on: ubuntu-latest
steps:
- name: 'Check permission'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTOR: ${{ github.triggering_actor }}
REPO: ${{ github.repository }}
run: |
HAS_MAINTAIN=$(gh api "repos/$REPO/collaborators/$ACTOR/permission" --jq '.user.permissions.maintain')
echo "Maintain permission for $ACTOR: $HAS_MAINTAIN"
if [ "$HAS_MAINTAIN" = "true" ]; then
echo "Access granted: $ACTOR has maintain permission."
else
echo "Access denied: $ACTOR does not have maintain permission."
exit 1
fi