@@ -19,14 +19,35 @@ jobs:
19
19
echo "COLOR=red" >> $GITHUB_ENV
20
20
fi
21
21
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