Skip to content

Commit f1c7b13

Browse files
committed
Doc badge
1 parent 765e2d7 commit f1c7b13

File tree

1 file changed

+32
-11
lines changed

1 file changed

+32
-11
lines changed

.github/workflows/website-status-check.yml

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,35 @@ jobs:
1919
echo "COLOR=red" >> $GITHUB_ENV
2020
fi
2121
22-
- name: Create status badge
23-
uses: schneegans/[email protected]
24-
with:
25-
auth: ${{ secrets.GIST_SECRET }}
26-
gistID: ${{ secrets.GIST_ID }}
27-
filename: django-appointment-doc-status.json
28-
label: docs
29-
message: ${{ env.STATUS }}
30-
color: ${{ env.COLOR }}
31-
isError: ${{ env.STATUS == 'down' }}
32-
namedLogo: django
22+
- name: Update Gist
23+
env:
24+
GIST_ID: ${{ secrets.GIST_ID }}
25+
GH_TOKEN: ${{ secrets.GIST_SECRET }}
26+
run: |
27+
GIST_CONTENT=$(cat << EOF
28+
{
29+
"schemaVersion": 1,
30+
"label": "django-appointment docs",
31+
"message": "${{ env.STATUS }}",
32+
"color": "${{ env.COLOR }}",
33+
"isError": ${{ env.STATUS == 'down' }},
34+
"namedLogo": "django"
35+
}
36+
EOF
37+
)
38+
39+
RESPONSE=$(curl -s -X PATCH \
40+
-H "Authorization: token $GH_TOKEN" \
41+
-H "Content-Type: application/json" \
42+
-d "{\"files\": {\"django-appointment-doc-status.json\": {\"content\": $(echo $GIST_CONTENT | jq -R -s '.')}}}" \
43+
"https://api.github.com/gists/$GIST_ID")
44+
45+
echo "Gist update response:"
46+
echo "$RESPONSE" | jq '.'
47+
48+
if echo "$RESPONSE" | jq -e '.files."django-appointment-doc-status.json"' > /dev/null; then
49+
echo "Gist updated successfully"
50+
else
51+
echo "Failed to update gist"
52+
exit 1
53+
fi

0 commit comments

Comments
 (0)