Skip to content

Commit 8f116f0

Browse files
committed
feat: add DV_CAN_RELEASE variable
1 parent e7e4755 commit 8f116f0

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.github/actions/check-actor/action.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ description: checks if actor is allowed to call the workflow
33
author: datavisyn
44

55
inputs:
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
@@ -38,6 +51,7 @@ runs:
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 }}

.github/workflows/release-source.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ jobs:
7777
uses: ./tmp/github-workflows/.github/actions/check-actor
7878
with:
7979
dv_devops: ${{ vars.DV_DEVOPS }}
80+
allowed_users: ${{ vars.DV_CAN_RELEASE }}
8081
actor: ${{ github.actor }}
8182
qms_are_allowed: "false"
8283

0 commit comments

Comments
 (0)