File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 5757fi
5858
5959echo " Adding/inviting $user to $org /$repo with $permission permission..."
60- gh api -X PUT /repos/$org /$repo /collaborators/$user -f permission=$permission
60+ response=$( gh api -X PUT /repos/$org /$repo /collaborators/$user -f permission=$permission 2>&1 )
61+ exit_code=$?
62+
63+ if [ $exit_code -eq 0 ]; then
64+ echo " ✅ Successfully ensured $user has $permission permission on $org /$repo . (User may have been newly added or permission updated)"
65+ else
66+ # Check for specific error cases
67+ if echo " $response " | grep -q " Not Found" ; then
68+ echo " ❌ Error: Repository $org /$repo not found or insufficient permissions."
69+ exit 1
70+ else
71+ echo " ❌ Error adding $user to $org /$repo :"
72+ echo " $response "
73+ exit 1
74+ fi
75+ fi
You can’t perform that action at this time.
0 commit comments