add gitlab wiki scrape
parent
94fbde9cad
commit
8aa8b979f1
|
|
@ -0,0 +1,29 @@
|
|||
#! /bin/bash
|
||||
|
||||
GITLAB_PAT="$GITLAB_PAT"
|
||||
PROJECT="$PROJECT"
|
||||
BLOB="$BLOB"
|
||||
|
||||
urlencode() {
|
||||
# urlencode <string>
|
||||
|
||||
old_lc_collate=$LC_COLLATE
|
||||
LC_COLLATE=C
|
||||
|
||||
local length="${#1}"
|
||||
for (( i = 0; i < length; i++ )); do
|
||||
local c="${1:$i:1}"
|
||||
case $c in
|
||||
[a-zA-Z0-9.~_-]) printf '%s' "$c" ;;
|
||||
*) printf '%%%02X' "'$c" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
LC_COLLATE=$old_lc_collate
|
||||
}
|
||||
|
||||
project="$(urlencode $PROJECT)"
|
||||
blob="$(urlencode $BLOB)"
|
||||
path="api/v4/projects/$project/wikis/$blob"
|
||||
|
||||
curl -sS -H "Authorization: Bearer $GITLAB_PAT" "https://gitlab-app.eng.qops.net/$path" | jq -r .content
|
||||
Loading…
Reference in New Issue