@@ -3,6 +3,10 @@ description: checks if actor is allowed to call the workflow
33author : datavisyn
44
55inputs :
6+ allowed_users :
7+ description : " allowed users (seperated with ,)"
8+ required : false
9+ default : " "
610 dv_devops :
711 description : " devops of datavisyn (seperated with ,)"
812 required : true
@@ -22,14 +26,23 @@ runs:
2226 steps :
2327 - name : Check actor
2428 run : |
29+ allowed_users=$ALLOWED_USERS
2530 devops=$DV_DEVOPS
26- qms=$_DV_QMS
31+ qms=$DV_QMS
2732 actor=$GITHUB_ACTOR
33+ # Start with the DEVOPS users
2834 mapfile -t array1 < <(echo "${devops}" | tr ',' "\n")
29- if [[ -n $qms ]] && [[ $QMS_ALLOWED == "true" ]] ; then
35+ # Add the QMs
36+ if [[ -n $qms ]] && [[ $QMS_ALLOWED == "true" ]] ; then
3037 mapfile -t array2 < <(echo "${qms}" | tr ',' "\n")
3138 array1+=("${array2[@]}")
3239 fi
40+ # And all the allowed users
41+ if [[ -n $allowed_users ]]; then
42+ mapfile -t array3 < <(echo "${allowed_users}" | tr ',' "\n")
43+ array1+=("${array3[@]}")
44+ fi
45+ # And finally check for access
3346 for e in "${array1[@]}"; do
3447 if [[ "$e" == "$actor" ]] ; then
3548 exit 0
3851 echo "you are not allowed to run this job!"
3952 exit 1
4053 env :
54+ ALLOWED_USERS : ${{ inputs.allowed_users }}
4155 DV_DEVOPS : ${{ inputs.dv_devops }}
4256 DV_QMS : ${{ inputs.dv_qms }}
4357 GITHUB_ACTOR : ${{ inputs.actor }}
0 commit comments