File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -52,13 +52,24 @@ jobs:
52
52
- name : Check prod access
53
53
if : ${{ inputs.deployment_env == 'prod' }}
54
54
run : |
55
+ if [ "$GITHUB_REF" != "refs/heads/main" ]; then
56
+ echo "Error: Production deployments are only allowed from the main branch."
57
+ exit 1
58
+ fi
59
+
60
+ if [ "$GITHUB_REPOSITORY_OWNER" != "nginx" ] && [ "$GITHUB_REPOSITORY_OWNER" != "nginxinc" ]; then
61
+ echo "Error: This workflow is only allowed in repositories owned by 'nginx' or 'nginxinc'."
62
+ exit 1
63
+ fi
64
+
55
65
ALLOWED="${{ secrets.ALLOWED_USERS }}"
56
66
for user in $ALLOWED; do
57
67
if [ "$GITHUB_ACTOR" == "$user" ]; then
58
68
echo "User $GITHUB_ACTOR is allowed to deploy to prod"
59
69
exit 0
60
70
fi
61
71
done
72
+
62
73
echo "User $GITHUB_ACTOR is NOT allowed to deploy to prod"
63
74
exit 1
64
75
You can’t perform that action at this time.
0 commit comments