Skip to content

Commit aa7effa

Browse files
authored
feat: add DV_CAN_RELEASE variable (#171)
* feat: add DV_CAN_RELEASE variable * Allow publishing of packages via DV_CAN_RELEASE
1 parent e7e4755 commit aa7effa

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-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/publish-node-python.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
- uses: ./tmp/github-workflows/.github/actions/check-actor
5757
with:
5858
dv_devops: ${{ vars.DV_DEVOPS }}
59+
allowed_users: ${{ vars.DV_CAN_RELEASE }}
5960
actor: ${{ github.actor }}
6061
qms_are_allowed: "false"
6162
- uses: ./tmp/github-workflows/.github/actions/build-node-python
@@ -88,6 +89,7 @@ jobs:
8889
- uses: ./tmp/github-workflows/.github/actions/check-actor
8990
with:
9091
dv_devops: ${{ vars.DV_DEVOPS }}
92+
allowed_users: ${{ vars.DV_CAN_RELEASE }}
9193
actor: ${{ github.actor }}
9294
qms_are_allowed: "false"
9395
- uses: ./tmp/github-workflows/.github/actions/build-node-python

.github/workflows/publish-node.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
- uses: ./tmp/github-workflows/.github/actions/check-actor
4848
with:
4949
dv_devops: ${{ vars.DV_DEVOPS }}
50+
allowed_users: ${{ vars.DV_CAN_RELEASE }}
5051
actor: ${{ github.actor }}
5152
qms_are_allowed: "false"
5253
- uses: ./tmp/github-workflows/.github/actions/build-node-python

.github/workflows/publish-python.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
- uses: ./tmp/github-workflows/.github/actions/check-actor
4545
with:
4646
dv_devops: ${{ vars.DV_DEVOPS }}
47+
allowed_users: ${{ vars.DV_CAN_RELEASE }}
4748
actor: ${{ github.actor }}
4849
qms_are_allowed: "false"
4950
- uses: ./tmp/github-workflows/.github/actions/build-node-python

.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)