restructure: flatten scripts dirs, remove roster, update SKILL.md
This commit is contained in:
28
git-hangman-lab/scripts/check-git-cred
Executable file
28
git-hangman-lab/scripts/check-git-cred
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
GIT_URL="https://git.hangman-lab.top"
|
||||
|
||||
USER="$(secret-mgr get-username --key git)"
|
||||
PASS="$(secret-mgr get-secret --key git)"
|
||||
|
||||
if [[ -z "$USER" || -z "$PASS" ]]; then
|
||||
echo "Missing credentials from secret-mgr (key: git)"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
response=$(curl -s -w "%{http_code}" -u "$USER:$PASS" "$GIT_URL/api/v1/user")
|
||||
http_code="${response: -3}"
|
||||
body="${response:0:-3}"
|
||||
|
||||
if [[ "$http_code" == "200" ]]; then
|
||||
echo "OK"
|
||||
exit 0
|
||||
elif [[ "$http_code" == "401" ]]; then
|
||||
echo "AUTH FAILED"
|
||||
exit 1
|
||||
else
|
||||
echo "ERROR: HTTP $http_code"
|
||||
echo "$body"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user