Store pass/fail status for your README badges. Update from CI, read from anywhere.
You want a build status badge in your README, but you're not using a major CI platform with built-in badges. Or you want custom metrics beyond just "passing/failing".
Services like shields.io can fetch data from URLs, but you need somewhere to store the status first.
Store badge status in WrenDB from your CI pipeline. Use shields.io's endpoint badge to display it in your README.
curl -X POST https://wrendb.com/api/stash
# Save these as GitHub secrets:
# WREN_STASH_ID and WREN_TOKEN
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm test
# Update badge status
- name: Update build badge
if: always()
run: |
if [ "${{ job.status }}" == "success" ]; then
STATUS="passing"
COLOR="brightgreen"
else
STATUS="failing"
COLOR="red"
fi
# Store badge data as JSON
curl -X PUT https://wrendb.com/api/item/${{ secrets.WREN_STASH_ID }}/build-status \
-H "Authorization: Bearer ${{ secrets.WREN_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{
\"schemaVersion\": 1,
\"label\": \"build\",
\"message\": \"$STATUS\",
\"color\": \"$COLOR\"
}"
# My Project

Your project description here...
The badge will automatically update whenever your CI runs!
Track custom metrics like test coverage, performance scores, or deployment count:
# Extract coverage from your test output
COVERAGE=$(npm test -- --coverage | grep "All files" | awk '{print $10}')
# Determine color based on coverage
if [ ${COVERAGE%.*} -ge 80 ]; then
COLOR="brightgreen"
elif [ ${COVERAGE%.*} -ge 60 ]; then
COLOR="yellow"
else
COLOR="red"
fi
# Update WrenDB
curl -X PUT https://wrendb.com/api/item/$WREN_STASH_ID/coverage \
-H "Authorization: Bearer $WREN_TOKEN" \
-H "Content-Type: application/json" \
-d "{
\"schemaVersion\": 1,
\"label\": \"coverage\",
\"message\": \"${COVERAGE}\",
\"color\": \"$COLOR\"
}"

Shields.io expects this JSON structure:
{
"schemaVersion": 1,
"label": "build", // Left side text
"message": "passing", // Right side text
"color": "brightgreen" // Badge color
}
Colors: brightgreen, green, yellow, orange, red, blue, lightgrey