Skip to content

Commit b6c7f94

Browse files
authored
Update tests.yml
1 parent 653b127 commit b6c7f94

File tree

1 file changed

+30
-14
lines changed

1 file changed

+30
-14
lines changed

.github/workflows/tests.yml

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@ jobs:
7070
file: ./build/logs/clover.xml
7171
fail_ci_if_error: false
7272
token: ${{ secrets.CODECOV_TOKEN }}
73-
74-
- name: Check clover.xml format
75-
run: |
76-
echo "First 20 lines of clover.xml:"
77-
head -n 20 build/logs/clover.xml
7873

7974
- name: Extract coverage percentage
8075
id: extract_coverage
@@ -119,12 +114,33 @@ jobs:
119114
echo "color=$COLOR" >> $GITHUB_OUTPUT
120115
echo "Badge color: $COLOR"
121116
122-
- name: Create coverage badge
123-
uses: schneegans/[email protected]
124-
with:
125-
auth: ${{ secrets.GIST_SECRET }}
126-
gistID: ${{ secrets.GIST_ID }}
127-
filename: polyglot-coverage.json
128-
label: coverage
129-
message: ${{ steps.extract_coverage.outputs.percentage }}%
130-
color: ${{ steps.badge_color.outputs.color }}
117+
- name: Update coverage badge via direct API call
118+
env:
119+
GIST_ID: ${{ secrets.GIST_ID }}
120+
GIST_TOKEN: ${{ secrets.GIST_SECRET }}
121+
PERCENTAGE: ${{ steps.extract_coverage.outputs.percentage }}
122+
COLOR: ${{ steps.badge_color.outputs.color }}
123+
run: |
124+
# Create JSON data for the badge
125+
BADGE_JSON='{
126+
"schemaVersion": 1,
127+
"label": "coverage",
128+
"message": "'$PERCENTAGE'%",
129+
"color": "'$COLOR'"
130+
}'
131+
132+
# Create JSON payload for GitHub API
133+
GIST_CONTENT='{
134+
"files": {
135+
"polyglot-coverage.json": {
136+
"content": '$(echo "$BADGE_JSON" | jq -R .)'
137+
}
138+
}
139+
}'
140+
141+
# Update the Gist using curl
142+
curl -X PATCH \
143+
-H "Accept: application/vnd.github.v3+json" \
144+
-H "Authorization: token $GIST_TOKEN" \
145+
-d "$GIST_CONTENT" \
146+
"https://api.github.com/gists/$GIST_ID"

0 commit comments

Comments
 (0)