Skip to content

Commit 811fe0c

Browse files
committed
Revise check org membership
Prior test was unnecessarily complex and resulting in a non-useful message in error case The automation token can be added into drone using the drone cli: * drone secret add or * login to the drone webui, go to profile->secrets, and update via the box in the top right https://ci-vic.vmware.com/vmware/vic/settings/secrets at time of writing
1 parent 09940c8 commit 811fe0c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/check-org-membership.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ if [ "$SKIP_CHECK_MEMBERSHIP" == "true" ]; then
2424
exit 0
2525
fi
2626

27-
if [ ! $(curl --silent -H "Authorization: token $GITHUB_AUTOMATION_API_KEY" "https://api.github.com/orgs/vmware/members/${DRONE_COMMIT_AUTHOR}") ]; then
27+
# assuming that the logic here is both a successful curl AND no output.
28+
# testing with a bad auth token shows a 0 return code for curl, but json blob with error
29+
# good auth token is just empty response
30+
result=$(curl --silent -H "Authorization: token $GITHUB_AUTOMATION_API_KEY" "https://api.github.com/orgs/vmware/members/${DRONE_COMMIT_AUTHOR}")
31+
if [ "$?" -eq 0 -o -n "$result" ]; then
2832
echo "checked origin membership successfully"
2933
else
3034
echo "failed to check origin membership"

0 commit comments

Comments
 (0)