Update content
This commit is contained in:
parent
22c1325675
commit
2b5ebd9b81
@ -57,7 +57,7 @@ jobs:
|
|||||||
apt-get -o Acquire::Check-Valid-Until=false update -y
|
apt-get -o Acquire::Check-Valid-Until=false update -y
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||||
git ca-certificates python3-pip rsync \
|
git ca-certificates python3-pip rsync \
|
||||||
libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info \
|
libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf-2.0-0 libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libffi-dev shared-mime-info \
|
||||||
fontconfig fonts-noto-cjk fonts-wqy-microhei
|
fontconfig fonts-noto-cjk fonts-wqy-microhei
|
||||||
fc-cache -f -v >/dev/null 2>&1 || true
|
fc-cache -f -v >/dev/null 2>&1 || true
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
@ -226,9 +226,7 @@ jobs:
|
|||||||
DEST_PATH="reports/grade_report_${SHORT_SHA}.${REPORT_FILE##*.}"
|
DEST_PATH="reports/grade_report_${SHORT_SHA}.${REPORT_FILE##*.}"
|
||||||
|
|
||||||
CONTENT=$(base64 -w 0 "$REPORT_FILE")
|
CONTENT=$(base64 -w 0 "$REPORT_FILE")
|
||||||
cat > /tmp/upload_request.json << EOF
|
printf '{"message": "Add grade report for %s", "content": "%s"}\n' "$SHORT_SHA" "$CONTENT" > /tmp/upload_request.json
|
||||||
{"message": "Add grade report for $SHORT_SHA", "content": "$CONTENT"}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
RESULT=$(curl -s -X POST -H "Authorization: token $TOKEN" \
|
RESULT=$(curl -s -X POST -H "Authorization: token $TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
@ -244,9 +242,7 @@ EOF
|
|||||||
| python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('sha','') if isinstance(d,dict) and 'sha' in d else '')" 2>/dev/null || echo "")
|
| python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('sha','') if isinstance(d,dict) and 'sha' in d else '')" 2>/dev/null || echo "")
|
||||||
|
|
||||||
if [ -n "$SHA" ]; then
|
if [ -n "$SHA" ]; then
|
||||||
cat > /tmp/upload_request.json << EOF
|
printf '{"message": "Update grade report for %s", "content": "%s", "sha": "%s"}\n' "$SHORT_SHA" "$CONTENT" "$SHA" > /tmp/upload_request.json
|
||||||
{"message": "Update grade report for $SHORT_SHA", "content": "$CONTENT", "sha": "$SHA"}
|
|
||||||
EOF
|
|
||||||
RESULT=$(curl -s -X PUT -H "Authorization: token $TOKEN" \
|
RESULT=$(curl -s -X PUT -H "Authorization: token $TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
"$API_URL/repos/$REPO/contents/$DEST_PATH" \
|
"$API_URL/repos/$REPO/contents/$DEST_PATH" \
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user